ArunSamespace commited on
Commit
a09adc5
1 Parent(s): 783cd75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -5,10 +5,13 @@ import gradio as gr
5
  import pandas as pd
6
  from model import Model
7
  from tqdm import tqdm
 
 
8
 
9
  tqdm.pandas()
10
 
11
  OUTPUT_FILE = "./results_qa.csv"
 
12
 
13
  def new_vote(data: gr.LikeData, question, model_name, **kwargs):
14
  feedback = "Good" if data.liked else "Bad"
@@ -78,9 +81,6 @@ if __name__ == "__main__":
78
  with gr.Blocks() as demo:
79
  chatbot = gr.Chatbot()
80
 
81
- # with gr.Row():
82
-
83
- textbox = gr.Textbox(label="Query")
84
  # system_prompt = """Answer the question using the context. Provide examples only from the context and use only Rupees (₹) in examples. If you don't know the answer, just say 'Please rephrase the question I am unable to answer'"""
85
  system_prompt = """"Answer the question using the context. Provide examples only from the context and use only Rupees (₹) in examples. If you don't know the answer, just say 'Please rephrase the question I am unable to answer'"""
86
  system_prompt = "Use the following pieces of book to answer the question at the end. \nIf you don't know the answer, please think rationally and answer from the book"
@@ -90,7 +90,10 @@ if __name__ == "__main__":
90
  choices=["gpt4", "gpt-3.5-turbo"]
91
 
92
  system_prompt = gr.Textbox(value=system_prompt, label="System Prompt")
 
93
  model_name = gr.Dropdown(choices=choices, value="gpt-3.5-turbo", label="Model")
 
 
94
  file = gr.File(value = OUTPUT_FILE, file_types=["csv"], label="Output")
95
  textbox.submit(answer_question, [textbox, model_name, system_prompt], [chatbot, file])
96
  chatbot.like(new_vote, [textbox, model_name], None)
 
5
  import pandas as pd
6
  from model import Model
7
  from tqdm import tqdm
8
+ from gradio_pdf import PDF
9
+
10
 
11
  tqdm.pandas()
12
 
13
  OUTPUT_FILE = "./results_qa.csv"
14
+ TOC_FILE = "./TOC.pdf"
15
 
16
  def new_vote(data: gr.LikeData, question, model_name, **kwargs):
17
  feedback = "Good" if data.liked else "Bad"
 
81
  with gr.Blocks() as demo:
82
  chatbot = gr.Chatbot()
83
 
 
 
 
84
  # system_prompt = """Answer the question using the context. Provide examples only from the context and use only Rupees (₹) in examples. If you don't know the answer, just say 'Please rephrase the question I am unable to answer'"""
85
  system_prompt = """"Answer the question using the context. Provide examples only from the context and use only Rupees (₹) in examples. If you don't know the answer, just say 'Please rephrase the question I am unable to answer'"""
86
  system_prompt = "Use the following pieces of book to answer the question at the end. \nIf you don't know the answer, please think rationally and answer from the book"
 
90
  choices=["gpt4", "gpt-3.5-turbo"]
91
 
92
  system_prompt = gr.Textbox(value=system_prompt, label="System Prompt")
93
+ textbox = gr.Textbox(label="Query")
94
  model_name = gr.Dropdown(choices=choices, value="gpt-3.5-turbo", label="Model")
95
+ pdf = PDF(interactive=True, value=TOC_FILE, label="Tabel of Contents")
96
+
97
  file = gr.File(value = OUTPUT_FILE, file_types=["csv"], label="Output")
98
  textbox.submit(answer_question, [textbox, model_name, system_prompt], [chatbot, file])
99
  chatbot.like(new_vote, [textbox, model_name], None)