Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# imports
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import requests
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# functions
|
| 8 |
+
def check(v1, v2):
|
| 9 |
+
if not v1 or not v2:
|
| 10 |
+
raise gr.Error("Выберите все ответы!")
|
| 11 |
+
return None
|
| 12 |
+
if v1 == 'А':
|
| 13 |
+
v1 = "✔"
|
| 14 |
+
if v2 == 'Б':
|
| 15 |
+
v2 = "✔"
|
| 16 |
+
|
| 17 |
+
return f"{v1} - {v2}"
|
| 18 |
+
# css
|
| 19 |
+
css = """
|
| 20 |
+
footer {visibility: hidden !important;}
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# ui
|
| 25 |
+
with gr.Blocks(css=css, theme='YTheme/TehnoX') as vui:
|
| 26 |
+
with gr.Row():
|
| 27 |
+
v1 = gr.Radio(label="Вопрос 1", info="Выберите А", choices=["А", "Б", "В"])
|
| 28 |
+
v2 = gr.Radio(label="Вопрос 2", info="Выберите Б", choices=["А", "Б", "В"])
|
| 29 |
+
text_button = gr.Button("Проверить", variant='primary')
|
| 30 |
+
with gr.Tab("Результаты"):
|
| 31 |
+
text_output = gr.Markdown("")
|
| 32 |
+
text_button.click(check, inputs=[promt, model, max_tokens], outputs=[text_output, text_output_nm])
|
| 33 |
+
|
| 34 |
+
#end
|
| 35 |
+
vui.queue(api_open=False).launch()
|