Manggomee commited on
Commit
0ce78a5
·
verified ·
1 Parent(s): 8bdbbdb

Upload 2 files

Browse files
Files changed (2) hide show
  1. add.py +23 -0
  2. requirements.txt +3 -1
add.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ print('add.py 실행 시작!')
2
+
3
+ from transformers import pipeline
4
+ import gradio as gr
5
+
6
+ qna = pipeline("question-answering")
7
+
8
+ def answer_question(question, context):
9
+ result = qna({
10
+ "question": question,
11
+ "context": context
12
+ })
13
+ if isinstance(result, list):
14
+ return result[0]['answer']
15
+ return result['answer']
16
+
17
+ demo = gr.Interface(
18
+ fn=answer_question,
19
+ inputs=["text", "text"],
20
+ outputs="text",
21
+ title="Question Answering"
22
+ )
23
+ demo.launch()
requirements.txt CHANGED
@@ -1 +1,3 @@
1
- huggingface_hub==0.25.2
 
 
 
1
+ fastapi
2
+ streamlit
3
+ gradio