Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,46 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def hermes_speak(text, style):
|
| 8 |
-
response = f"Hermes hears you: {text}"
|
| 9 |
-
|
| 10 |
-
if style == "Silent":
|
| 11 |
-
return response, None
|
| 12 |
-
|
| 13 |
-
elif style == "Female":
|
| 14 |
-
audio = tts_model(response)["audio"]
|
| 15 |
-
return response, audio
|
| 16 |
-
|
| 17 |
-
elif style == "Old Man":
|
| 18 |
-
# Placeholder: deeper voice model can be added later
|
| 19 |
-
return "Old Man voice not yet wired in.", None
|
| 20 |
-
|
| 21 |
-
else:
|
| 22 |
-
return "Unknown voice style.", None
|
| 23 |
|
| 24 |
def handle_file(file):
|
| 25 |
return f"Uploaded file: {file.name}"
|
| 26 |
|
| 27 |
with gr.Blocks() as demo:
|
| 28 |
-
gr.Markdown("#
|
| 29 |
-
gr.Markdown("Type
|
| 30 |
|
| 31 |
with gr.Row():
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
output_text = gr.Textbox(label="Hermes Responds")
|
| 36 |
-
output_audio = gr.Audio(label="Voice Output", type="numpy")
|
| 37 |
|
| 38 |
-
submit_btn = gr.Button("
|
| 39 |
-
submit_btn.click(fn=
|
| 40 |
|
| 41 |
gr.Markdown("## 📁 Upload a File")
|
| 42 |
file_input = gr.File(label="Choose a file")
|
| 43 |
-
|
| 44 |
-
file_input.change(fn=handle_file, inputs=file_input, outputs=
|
| 45 |
|
| 46 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
def hermes_chat(message):
|
| 4 |
+
# Placeholder response logic
|
| 5 |
+
return f"Hermes says: {message}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def handle_file(file):
|
| 8 |
return f"Uploaded file: {file.name}"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown("# 💬 Hermes Chat Interface")
|
| 12 |
+
gr.Markdown("Type your message below or upload a file.")
|
| 13 |
|
| 14 |
with gr.Row():
|
| 15 |
+
chat_input = gr.Textbox(label="You", placeholder="Type your message here...")
|
| 16 |
+
chat_output = gr.Textbox(label="Hermes", interactive=False)
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
submit_btn = gr.Button("Send")
|
| 19 |
+
submit_btn.click(fn=hermes_chat, inputs=chat_input, outputs=chat_output)
|
| 20 |
|
| 21 |
gr.Markdown("## 📁 Upload a File")
|
| 22 |
file_input = gr.File(label="Choose a file")
|
| 23 |
+
file_status = gr.Textbox(label="File Status", interactive=False)
|
| 24 |
+
file_input.change(fn=handle_file, inputs=file_input, outputs=file_status)
|
| 25 |
|
| 26 |
demo.launch()
|