Spaces:
Build error
Build error
Add header html
Browse files- app.py +1 -1
- explanation.py +15 -0
- requirements.txt +1 -0
- translator.py +0 -7
app.py
CHANGED
@@ -180,7 +180,7 @@ def process_image(image, prompts, model):
|
|
180 |
def setup_gradio_interface(model):
|
181 |
"""Configure l'interface Gradio."""
|
182 |
return gr.Interface(
|
183 |
-
theme=gr.Theme.from_hub("
|
184 |
fn=lambda img, txt: process_image(img, txt, model),
|
185 |
inputs=[
|
186 |
gr.Image(type="numpy", label="Image médicale"),
|
|
|
180 |
def setup_gradio_interface(model):
|
181 |
"""Configure l'interface Gradio."""
|
182 |
return gr.Interface(
|
183 |
+
theme=gr.Theme.from_hub("lone17/kotaemon"),
|
184 |
fn=lambda img, txt: process_image(img, txt, model),
|
185 |
inputs=[
|
186 |
gr.Image(type="numpy", label="Image médicale"),
|
explanation.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
|
3 |
+
client = openai.Client()
|
4 |
+
|
5 |
+
def explain(model, input_text, max_tokens=100):
|
6 |
+
response = client.Completion.create(
|
7 |
+
model=model,
|
8 |
+
prompt=input_text,
|
9 |
+
max_tokens=max_tokens,
|
10 |
+
temperature=0,
|
11 |
+
top_p=1,
|
12 |
+
frequency_penalty=0,
|
13 |
+
presence_penalty=0
|
14 |
+
)
|
15 |
+
return response.choices[0].text.strip()
|
requirements.txt
CHANGED
@@ -33,6 +33,7 @@ open-clip-torch==2.26.1
|
|
33 |
nibabel==5.1.0
|
34 |
git+https://github.com/facebookresearch/detectron2
|
35 |
gradio
|
|
|
36 |
#torch==2.3.1 #2.0.1
|
37 |
#torchvision==0.15.2
|
38 |
#torchaudio==2.0.2
|
|
|
33 |
nibabel==5.1.0
|
34 |
git+https://github.com/facebookresearch/detectron2
|
35 |
gradio
|
36 |
+
openai
|
37 |
#torch==2.3.1 #2.0.1
|
38 |
#torchvision==0.15.2
|
39 |
#torchaudio==2.0.2
|
translator.py
CHANGED
@@ -29,10 +29,3 @@ def translate_text(text, source_lang, target_lang):
|
|
29 |
print(f"An error occurred: {e}")
|
30 |
return text
|
31 |
|
32 |
-
if __name__ == "__main__":
|
33 |
-
text_to_translate = "Dans cette image donne moi l'œdème"
|
34 |
-
source_language = "fr"
|
35 |
-
target_language = "en"
|
36 |
-
translation = translate_text(text_to_translate, source_language, target_language)
|
37 |
-
if translation:
|
38 |
-
print(translation)
|
|
|
29 |
print(f"An error occurred: {e}")
|
30 |
return text
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|