cafierom commited on
Commit
365aaea
·
verified ·
1 Parent(s): 8f4cfe9

Upload 2 files

Browse files
Files changed (2) hide show
  1. MoDrAg_hello.mp3 +0 -0
  2. app.py +10 -1
MoDrAg_hello.mp3 ADDED
Binary file (53 kB). View file
 
app.py CHANGED
@@ -6,6 +6,7 @@ from langgraph.graph.message import add_messages
6
  from langgraph.prebuilt import ToolNode, tools_condition
7
  import gradio as gr
8
  import spaces
 
9
 
10
  from PIL import Image
11
  from collections import Counter
@@ -107,7 +108,7 @@ def send_reasoning():
107
  start_chat()
108
 
109
  with gr.Blocks(fill_height=True) as OpenAIMoDrAg:
110
- gr.Markdown('''
111
  # MoDrAg Chatbot using ChatGPT 5.2
112
  - The *MOdular DRug design AGent*!
113
  - This chatbot can answer questions about molecules, proteins, and their interactions.
@@ -127,4 +128,12 @@ with gr.Blocks(fill_height=True) as OpenAIMoDrAg:
127
  sub_button.click(chat_turn, [msg], [msg, img_box, chat])
128
  clear.click(start_chat, [], [])
129
 
 
 
 
 
 
 
 
 
130
  OpenAIMoDrAg.launch(mcp_server = True)
 
6
  from langgraph.prebuilt import ToolNode, tools_condition
7
  import gradio as gr
8
  import spaces
9
+ import base64
10
 
11
  from PIL import Image
12
  from collections import Counter
 
108
  start_chat()
109
 
110
  with gr.Blocks(fill_height=True) as OpenAIMoDrAg:
111
+ top = gr.Markdown('''
112
  # MoDrAg Chatbot using ChatGPT 5.2
113
  - The *MOdular DRug design AGent*!
114
  - This chatbot can answer questions about molecules, proteins, and their interactions.
 
128
  sub_button.click(chat_turn, [msg], [msg, img_box, chat])
129
  clear.click(start_chat, [], [])
130
 
131
+ @gr.render(inputs=top)
132
+ def get_speech(args):
133
+ audio_file = 'MoDrAg/SemanticMoDrAg/data/MoDrAg_hello.mp3'
134
+ with open(audio_file, 'rb') as audio_bytes:
135
+ audio = base64.b64encode(audio_bytes.read()).decode("utf-8")
136
+ audio_player = f'<audio src="data:audio/mpeg;base64,{audio}" controls autoplay></audio>'
137
+ talk_ele = gr.HTML(audio_player)
138
+
139
  OpenAIMoDrAg.launch(mcp_server = True)