Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
app.py
CHANGED
|
@@ -8,7 +8,8 @@ import random
|
|
| 8 |
import json
|
| 9 |
from datetime import datetime
|
| 10 |
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
voice_options = {
|
| 14 |
"Rachel": "EXAVITQu4vr4xnSDxMaL",
|
|
@@ -28,7 +29,7 @@ def generate_chat_bundle(prompt, character_inputs):
|
|
| 28 |
f"Group chat between {', '.join(characters)}. Prompt: {prompt}. "
|
| 29 |
"Use casual texting style: Name: message"
|
| 30 |
)
|
| 31 |
-
response = chat_gen(system_prompt, max_new_tokens=
|
| 32 |
chat_lines = [(line.split(':', 1)[0].strip(), line.split(':', 1)[1].strip()) for line in response.splitlines() if ':' in line]
|
| 33 |
|
| 34 |
html_chat = ""
|
|
@@ -108,5 +109,4 @@ with gr.Blocks() as app:
|
|
| 108 |
generate_btn.click(fn=generate_chat_bundle, inputs=[prompt, characters], outputs=file_output)
|
| 109 |
refresh_btn.click(fn=get_library, outputs=lib_html)
|
| 110 |
|
| 111 |
-
# ✅ Required to launch on Hugging Face
|
| 112 |
app.launch()
|
|
|
|
| 8 |
import json
|
| 9 |
from datetime import datetime
|
| 10 |
|
| 11 |
+
# ✅ Public-access model for Hugging Face
|
| 12 |
+
chat_gen = pipeline("text-generation", model="tiiuae/falcon-7b-instruct")
|
| 13 |
|
| 14 |
voice_options = {
|
| 15 |
"Rachel": "EXAVITQu4vr4xnSDxMaL",
|
|
|
|
| 29 |
f"Group chat between {', '.join(characters)}. Prompt: {prompt}. "
|
| 30 |
"Use casual texting style: Name: message"
|
| 31 |
)
|
| 32 |
+
response = chat_gen(system_prompt, max_new_tokens=300)[0]["generated_text"]
|
| 33 |
chat_lines = [(line.split(':', 1)[0].strip(), line.split(':', 1)[1].strip()) for line in response.splitlines() if ':' in line]
|
| 34 |
|
| 35 |
html_chat = ""
|
|
|
|
| 109 |
generate_btn.click(fn=generate_chat_bundle, inputs=[prompt, characters], outputs=file_output)
|
| 110 |
refresh_btn.click(fn=get_library, outputs=lib_html)
|
| 111 |
|
|
|
|
| 112 |
app.launch()
|