Spaces:
Sleeping
Sleeping
Allen Park
commited on
Commit
·
07651a1
1
Parent(s):
e200600
chore(remove old comments with unused code)
Browse files
app.py
CHANGED
@@ -11,15 +11,6 @@ from docx import Document
|
|
11 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
12 |
LEPTON_API_TOKEN = os.environ.get("LEPTON_API_TOKEN", None)
|
13 |
|
14 |
-
# client=openai.OpenAI(
|
15 |
-
# base_url="https://yb15a7dy-patronus-lynx-8b-v1-1.tin.lepton.run/api/v1/",
|
16 |
-
# api_key=LEPTON_API_TOKEN
|
17 |
-
# )
|
18 |
-
# client=openai.OpenAI(
|
19 |
-
# base_url="https://yb15a7dy-lynx-70b.tin.lepton.run/api/v1/",
|
20 |
-
# api_key=LEPTON_API_TOKEN
|
21 |
-
# )
|
22 |
-
|
23 |
PROMPT = """
|
24 |
Given the following QUESTION, DOCUMENT and ANSWER you must analyze the provided answer and determine whether it is faithful to the contents of the DOCUMENT. The ANSWER must not offer new information beyond the context provided in the DOCUMENT. The ANSWER also must not contradict information provided in the DOCUMENT. Output your final verdict by strictly following this format: "PASS" if the answer is faithful to the DOCUMENT and "FAIL" if the answer is not faithful to the DOCUMENT. Show your reasoning.
|
25 |
|
@@ -203,7 +194,6 @@ def upload_file(filepath):
|
|
203 |
return [gr.UploadButton(visible=False), gr.Group(visible=True), gr.Markdown(f"**Uploaded file:** {name}"), extracted_file_text]
|
204 |
else:
|
205 |
return [gr.UploadButton(visible=True, file_count="single", file_types=UPLOADABLE_FILE_TYPES), gr.Group(visible=False), gr.Markdown(""), extracted_file_text]
|
206 |
-
# return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download {name}", value=filepath, visible=True)]
|
207 |
def reset_buttons():
|
208 |
return [gr.UploadButton(visible=True, file_count="single", file_types=UPLOADABLE_FILE_TYPES), gr.Group(visible=False), gr.Markdown(""), gr.Textbox(value="")]
|
209 |
|
@@ -213,20 +203,9 @@ def select_template(template):
|
|
213 |
# def download_file():
|
214 |
# return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|
215 |
|
216 |
-
# inputs = [
|
217 |
-
# gr.Textbox(label="Question"),
|
218 |
-
# gr.Textbox(label="Document"),
|
219 |
-
# gr.Textbox(label="Answer")
|
220 |
-
# ]
|
221 |
-
# outputs = [
|
222 |
-
# gr.Textbox(label="Reasoning"),
|
223 |
-
# gr.Textbox(label="Score")
|
224 |
-
# ]
|
225 |
-
|
226 |
with gr.Blocks(css=css) as demo:
|
227 |
base_url_state = gr.State(update_client_base_url("Patronus Lynx 8B v1.1"))
|
228 |
gr.Markdown(HEADER)
|
229 |
-
# gr.Interface(fn=model_call, inputs=inputs, outputs=outputs)
|
230 |
model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B v1.1", "Patronus Lynx 70B"], value="Patronus Lynx 8B v1.1", label="Model", interactive=True)
|
231 |
with gr.Row():
|
232 |
with gr.Column(scale=1):
|
|
|
11 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
12 |
LEPTON_API_TOKEN = os.environ.get("LEPTON_API_TOKEN", None)
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
PROMPT = """
|
15 |
Given the following QUESTION, DOCUMENT and ANSWER you must analyze the provided answer and determine whether it is faithful to the contents of the DOCUMENT. The ANSWER must not offer new information beyond the context provided in the DOCUMENT. The ANSWER also must not contradict information provided in the DOCUMENT. Output your final verdict by strictly following this format: "PASS" if the answer is faithful to the DOCUMENT and "FAIL" if the answer is not faithful to the DOCUMENT. Show your reasoning.
|
16 |
|
|
|
194 |
return [gr.UploadButton(visible=False), gr.Group(visible=True), gr.Markdown(f"**Uploaded file:** {name}"), extracted_file_text]
|
195 |
else:
|
196 |
return [gr.UploadButton(visible=True, file_count="single", file_types=UPLOADABLE_FILE_TYPES), gr.Group(visible=False), gr.Markdown(""), extracted_file_text]
|
|
|
197 |
def reset_buttons():
|
198 |
return [gr.UploadButton(visible=True, file_count="single", file_types=UPLOADABLE_FILE_TYPES), gr.Group(visible=False), gr.Markdown(""), gr.Textbox(value="")]
|
199 |
|
|
|
203 |
# def download_file():
|
204 |
# return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
with gr.Blocks(css=css) as demo:
|
207 |
base_url_state = gr.State(update_client_base_url("Patronus Lynx 8B v1.1"))
|
208 |
gr.Markdown(HEADER)
|
|
|
209 |
model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B v1.1", "Patronus Lynx 70B"], value="Patronus Lynx 8B v1.1", label="Model", interactive=True)
|
210 |
with gr.Row():
|
211 |
with gr.Column(scale=1):
|