Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
app.py
CHANGED
@@ -8,7 +8,6 @@ import random
|
|
8 |
import json
|
9 |
from datetime import datetime
|
10 |
|
11 |
-
# β
Lightweight model that works on Hugging Face CPU
|
12 |
chat_gen = pipeline("text-generation", model="tiiuae/falcon-rw-1b")
|
13 |
|
14 |
voice_options = {
|
@@ -21,7 +20,7 @@ voice_options = {
|
|
21 |
DEFAULT_ELEVEN_API_KEY = "sk_4e67c39c0e9cbc87462cd2643e1f4d1d9959d7d81203adc2"
|
22 |
library_file = "/tmp/library.json"
|
23 |
|
24 |
-
def generate_chat_bundle(prompt, character_inputs):
|
25 |
characters = [c.split(":")[0].strip() for c in character_inputs if ":" in c]
|
26 |
voices = {c.split(":")[0].strip(): c.split(":")[1].strip() for c in character_inputs if ":" in c}
|
27 |
|
@@ -106,7 +105,7 @@ with gr.Blocks() as app:
|
|
106 |
lib_html = gr.HTML(label="π My Saved Stories")
|
107 |
refresh_btn = gr.Button("π Refresh Library")
|
108 |
|
109 |
-
generate_btn.click(fn=generate_chat_bundle, inputs=[prompt
|
110 |
refresh_btn.click(fn=get_library, outputs=lib_html)
|
111 |
|
112 |
app.launch()
|
|
|
8 |
import json
|
9 |
from datetime import datetime
|
10 |
|
|
|
11 |
chat_gen = pipeline("text-generation", model="tiiuae/falcon-rw-1b")
|
12 |
|
13 |
voice_options = {
|
|
|
20 |
DEFAULT_ELEVEN_API_KEY = "sk_4e67c39c0e9cbc87462cd2643e1f4d1d9959d7d81203adc2"
|
21 |
library_file = "/tmp/library.json"
|
22 |
|
23 |
+
def generate_chat_bundle(prompt, *character_inputs):
|
24 |
characters = [c.split(":")[0].strip() for c in character_inputs if ":" in c]
|
25 |
voices = {c.split(":")[0].strip(): c.split(":")[1].strip() for c in character_inputs if ":" in c}
|
26 |
|
|
|
105 |
lib_html = gr.HTML(label="π My Saved Stories")
|
106 |
refresh_btn = gr.Button("π Refresh Library")
|
107 |
|
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 |
app.launch()
|