Jkalonji commited on
Commit
b71645d
1 Parent(s): b3ffb75

Putting all in the app file

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -13,6 +13,9 @@ from config import HUGGINGFACEHUB_API_TOKEN
13
 
14
  from transformers import pipeline
15
 
 
 
 
16
  os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN
17
 
18
  # Vous pouvez choisir parmi les nombreux midèles disponibles sur HugginFace (https://huggingface.co/models)
@@ -86,3 +89,10 @@ def gradio_adapted_RAG(model_name, query):
86
  return generated_answer
87
 
88
 
 
 
 
 
 
 
 
 
13
 
14
  from transformers import pipeline
15
 
16
+ import gradio as gr
17
+
18
+
19
  os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN
20
 
21
  # Vous pouvez choisir parmi les nombreux midèles disponibles sur HugginFace (https://huggingface.co/models)
 
89
  return generated_answer
90
 
91
 
92
+ dropdown = gr.Dropdown(choices=["distilbert-base-uncased-distilled-squad",
93
+ "impira/layoutlm-document-qa",
94
+ "impira/layoutlm-invoices"], label="Choose a model")
95
+
96
+ iface = gr.Interface(fn=gradio_adapted_RAG, inputs=[dropdown, "text"], outputs="text")
97
+ iface.launch()
98
+