Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,23 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
demo = gr.Blocks()
|
| 4 |
with demo:
|
| 5 |
txt_file = gr.File(type="txt",label='CONTRACT')
|
| 6 |
-
text = gr.Textbox()
|
| 7 |
-
gr.Dropdown(choices=
|
| 8 |
b1 = gr.Button("Analyze File")
|
| 9 |
|
|
|
|
| 10 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def load_questions():
|
| 4 |
+
questions = []
|
| 5 |
+
with open('questions.txt') as f:
|
| 6 |
+
questions = f.readlines()
|
| 7 |
+
return questions
|
| 8 |
+
questions = load_questions()
|
| 9 |
+
|
| 10 |
+
def con(file):
|
| 11 |
+
with open(file.name) as f:
|
| 12 |
+
text = f.read()
|
| 13 |
+
return text
|
| 14 |
+
|
| 15 |
demo = gr.Blocks()
|
| 16 |
with demo:
|
| 17 |
txt_file = gr.File(type="txt",label='CONTRACT')
|
| 18 |
+
text = gr.Textbox(lines=10)
|
| 19 |
+
selected_ques=gr.Dropdown(choices=questions,label='SEARCH QUERY')
|
| 20 |
b1 = gr.Button("Analyze File")
|
| 21 |
|
| 22 |
+
b1.click(con, inputs=txt_file, outputs=text)
|
| 23 |
demo.launch()
|