diogocarapito commited on
Commit
51f18a0
·
1 Parent(s): 3bbfa05

roberta test

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -1,22 +1,21 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- gr.Interface.load("models/deepset/roberta-base-squad2-distilled").launch()
5
 
6
- '''
7
  modes_name = "deepset/roberta-base-squad2"
8
 
9
  pipe = pipeline("question-answering", model=model_name, tokenizer=model_name)
10
 
11
- def predict(text):
12
- return pipe(text)[0]["translation_text"]
13
 
14
- iface = gr.Interface(
15
- fn=predict,
 
 
 
16
  inputs='text',
17
- outputs='text',
18
- examples=[["Hello! My name is Omar"]]
19
  )
20
 
21
- iface.launch()'''
22
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
4
 
 
5
  modes_name = "deepset/roberta-base-squad2"
6
 
7
  pipe = pipeline("question-answering", model=model_name, tokenizer=model_name)
8
 
9
+ context = "my name is diogo and i'm 32 years old, i live in portugal neraby the ocean."
 
10
 
11
+ def q_and_a(text):
12
+ return pipe(text)[0]
13
+
14
+ interface = gr.Interface(
15
+ fn=q_and_a,
16
  inputs='text',
17
+ outputs='text'
 
18
  )
19
 
20
+ interface.launch()
21