Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
import os
|
4 |
-
import HongWenData # Importing the
|
5 |
import base64
|
6 |
|
7 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
@@ -21,8 +21,8 @@ def predict(question_choice, audio):
|
|
21 |
message = transcript["text"] # This is the transcribed message from the audio input
|
22 |
|
23 |
# Generate the system message based on the chosen question
|
24 |
-
current_question_index =
|
25 |
-
strategy, explanation =
|
26 |
|
27 |
# Construct the conversation with the system and user's message
|
28 |
conversation = [
|
@@ -57,7 +57,7 @@ def get_image_html():
|
|
57 |
iface = gr.Interface(
|
58 |
fn=predict,
|
59 |
inputs=[
|
60 |
-
gr.Radio(
|
61 |
gr.inputs.Audio(source="microphone", type="filepath") # Audio input
|
62 |
],
|
63 |
outputs=gr.inputs.Textbox(), # Using inputs.Textbox as an output to make it editable
|
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
import os
|
4 |
+
import HongWenData # Importing the HongWenData module
|
5 |
import base64
|
6 |
|
7 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
21 |
message = transcript["text"] # This is the transcribed message from the audio input
|
22 |
|
23 |
# Generate the system message based on the chosen question
|
24 |
+
current_question_index = HongWenData.questions.index(question_choice)
|
25 |
+
strategy, explanation = HongWenData.strategy_text[current_question_index]
|
26 |
|
27 |
# Construct the conversation with the system and user's message
|
28 |
conversation = [
|
|
|
57 |
iface = gr.Interface(
|
58 |
fn=predict,
|
59 |
inputs=[
|
60 |
+
gr.Radio(HongWenData.questions, label="Choose a question", default=HongWenData.questions[0]), # Dropdown for question choice
|
61 |
gr.inputs.Audio(source="microphone", type="filepath") # Audio input
|
62 |
],
|
63 |
outputs=gr.inputs.Textbox(), # Using inputs.Textbox as an output to make it editable
|