kirikir13 commited on
Commit
a79a4b2
·
verified ·
1 Parent(s): a423efe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -31
app.py CHANGED
@@ -1,46 +1,26 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- # Load Hugging Face TTS model (female voice)
5
- tts_model = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech")
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("# 🎙️ Hermes Voice Assistant")
29
- gr.Markdown("Type something below, choose a voice style, or upload a file.")
30
 
31
  with gr.Row():
32
- input_box = gr.Textbox(label="Your Input")
33
- voice_choice = gr.Dropdown(choices=["Female", "Old Man", "Silent"], label="Voice Style", value="Female")
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("Speak")
39
- submit_btn.click(fn=hermes_speak, inputs=[input_box, voice_choice], outputs=[output_text, output_audio])
40
 
41
  gr.Markdown("## 📁 Upload a File")
42
  file_input = gr.File(label="Choose a file")
43
- file_output = gr.Textbox(label="File Status")
44
- file_input.change(fn=handle_file, inputs=file_input, outputs=file_output)
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()