Spaces:
Runtime error
Runtime error
Commit
·
9d20b7c
1
Parent(s):
fba53f9
Text Question feature.
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ import torch
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
-
title = '
|
26 |
description = '''
|
27 |
'''
|
28 |
|
@@ -92,7 +92,7 @@ openai.api_key = os.environ.get("OPENAI_KEY")
|
|
92 |
|
93 |
|
94 |
def make_llm_call(prompt,
|
95 |
-
context="You are a text generation model DR-Brain Developed by team brute force team
|
96 |
messages = [{"role": "user", "content": prompt}]
|
97 |
if context:
|
98 |
messages.insert(0, {"role": "system", "content": context})
|
@@ -101,9 +101,11 @@ def make_llm_call(prompt,
|
|
101 |
return response_message
|
102 |
|
103 |
|
104 |
-
def detector(tumor_file, slice_number, channel, language, audio_question):
|
105 |
llm_answer = "Hi I'm Dr brain please enter a question to answer"
|
106 |
-
if
|
|
|
|
|
107 |
sampling_rate, waveform = audio_question
|
108 |
forced_decoder_ids = processor_whisper.get_decoder_prompt_ids(language=language, task="transcribe")
|
109 |
waveform = process_audio(sampling_rate, waveform)
|
@@ -137,7 +139,8 @@ interface = gr.Interface(fn=detector, inputs=[gr.File(label="Tumor File"),
|
|
137 |
gr.Slider(0, 200, 50, step=1, label="Slice Number"),
|
138 |
gr.Radio((0, 1, 2), label="Channel"),
|
139 |
gr.Radio(("english", "japanese", "german", "spanish"), label="Language"),
|
140 |
-
gr.Audio(
|
|
|
141 |
outputs=[gr.Image(label='channel', shape=(1, 1)),
|
142 |
gr.Image(label='Segmented Tumor', shape=(1, 1)),
|
143 |
gr.Textbox(label="Dr brain response")], title=title,
|
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
+
title = 'Dr Brain Tumors 🧠'
|
26 |
description = '''
|
27 |
'''
|
28 |
|
|
|
92 |
|
93 |
|
94 |
def make_llm_call(prompt,
|
95 |
+
context="You are a text generation model DR-Brain Developed by team brute force a team 4 AI engineers from RMKCET college they are HARSHA VARDHAN V , SAWIN KUMAR Y , CHARAN TEJA P, KISHORE S. Your specialized in medical stuff"):
|
96 |
messages = [{"role": "user", "content": prompt}]
|
97 |
if context:
|
98 |
messages.insert(0, {"role": "system", "content": context})
|
|
|
101 |
return response_message
|
102 |
|
103 |
|
104 |
+
def detector(tumor_file, slice_number, channel, language, audio_question, text_question):
|
105 |
llm_answer = "Hi I'm Dr brain please enter a question to answer"
|
106 |
+
if text_question:
|
107 |
+
llm_answer = make_llm_call(text_question)
|
108 |
+
elif audio_question:
|
109 |
sampling_rate, waveform = audio_question
|
110 |
forced_decoder_ids = processor_whisper.get_decoder_prompt_ids(language=language, task="transcribe")
|
111 |
waveform = process_audio(sampling_rate, waveform)
|
|
|
139 |
gr.Slider(0, 200, 50, step=1, label="Slice Number"),
|
140 |
gr.Radio((0, 1, 2), label="Channel"),
|
141 |
gr.Radio(("english", "japanese", "german", "spanish"), label="Language"),
|
142 |
+
gr.Audio(source="microphone"),
|
143 |
+
gr.Textbox(label='Text Question')],
|
144 |
outputs=[gr.Image(label='channel', shape=(1, 1)),
|
145 |
gr.Image(label='Segmented Tumor', shape=(1, 1)),
|
146 |
gr.Textbox(label="Dr brain response")], title=title,
|