Spaces:
Sleeping
Sleeping
Allen Park
commited on
Commit
·
7be224f
1
Parent(s):
23bdb9e
update lepton api to v1 of 8b and comment out 70b call; move dropdown to top and add interactive=true
Browse files
app.py
CHANGED
@@ -12,9 +12,13 @@ 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-lynx-
|
16 |
api_key=LEPTON_API_TOKEN
|
17 |
)
|
|
|
|
|
|
|
|
|
18 |
|
19 |
PROMPT = """
|
20 |
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.
|
@@ -121,6 +125,7 @@ outputs = [
|
|
121 |
with gr.Blocks() as demo:
|
122 |
gr.Markdown(HEADER)
|
123 |
# gr.Interface(fn=model_call, inputs=inputs, outputs=outputs)
|
|
|
124 |
with gr.Row():
|
125 |
with gr.Column(scale=1):
|
126 |
question = gr.Textbox(label="Question")
|
@@ -133,7 +138,6 @@ with gr.Blocks() as demo:
|
|
133 |
reasoning = gr.Textbox(label="Reasoning")
|
134 |
score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
|
135 |
|
136 |
-
model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B", "Patronus Lynx 70B"], value="Patronus Lynx 8B", label="Model")
|
137 |
# model_dropdown.change(fn=update_model, inputs=[model_dropdown, tokenizer_state, model_state], outputs=[tokenizer_state, model_state])
|
138 |
|
139 |
submit_button.click(fn=model_call, inputs=[question, document, answer], outputs=[reasoning, score])
|
|
|
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.
|
|
|
125 |
with gr.Blocks() as demo:
|
126 |
gr.Markdown(HEADER)
|
127 |
# gr.Interface(fn=model_call, inputs=inputs, outputs=outputs)
|
128 |
+
model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B", "Patronus Lynx 70B"], value="Patronus Lynx 8B", label="Model", interactive=True)
|
129 |
with gr.Row():
|
130 |
with gr.Column(scale=1):
|
131 |
question = gr.Textbox(label="Question")
|
|
|
138 |
reasoning = gr.Textbox(label="Reasoning")
|
139 |
score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
|
140 |
|
|
|
141 |
# model_dropdown.change(fn=update_model, inputs=[model_dropdown, tokenizer_state, model_state], outputs=[tokenizer_state, model_state])
|
142 |
|
143 |
submit_button.click(fn=model_call, inputs=[question, document, answer], outputs=[reasoning, score])
|