enotkrutoy commited on
Commit
72d1b84
·
verified ·
1 Parent(s): cd6d2f2

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -43
app.py DELETED
@@ -1,43 +0,0 @@
1
- import gradio as gr
2
- import os
3
- from g1 import gradio_interface # Измененный импорт
4
-
5
- def main(api_key, user_query, mode):
6
- if mode == "private" and not api_key:
7
- return "Please enter your Groq API key to proceed."
8
-
9
- if not user_query:
10
- return "Please enter a query to get started."
11
-
12
- try:
13
- # Логика обработки режима
14
- return gradio_interface(user_query)
15
- except Exception as e:
16
- return f"An error occurred: {str(e)}"
17
-
18
- with gr.Blocks() as demo:
19
- gr.Markdown("# 🧠 G1: Reasoning Chains with Llama-3")
20
-
21
- with gr.Row():
22
- with gr.Column():
23
- mode_toggle = gr.Radio(["public", "private"], label="API Key Mode", value="public")
24
- api_input = gr.Textbox(
25
- label="Enter Groq API Key:",
26
- type="password",
27
- visible=False
28
- )
29
- user_input = gr.Textbox(
30
- label="Your Query:",
31
- placeholder="e.g., Explain quantum computing basics",
32
- lines=3
33
- )
34
- submit_btn = gr.Button("Generate Response")
35
-
36
- with gr.Row():
37
- output_md = gr.Markdown()
38
-
39
- mode_toggle.change(lambda m: gr.update(visible=m == "private"), mode_toggle, api_input)
40
- submit_btn.click(fn=main, inputs=[api_input, user_input, mode_toggle], outputs=output_md)
41
-
42
- if __name__ == "__main__":
43
- demo.launch()