Ghanmidev2012 commited on
Commit
044aa7d
·
verified ·
1 Parent(s): eee27a3

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -37
app.py DELETED
@@ -1,37 +0,0 @@
1
- import gradio as gr
2
- import urllib.request
3
- import json
4
-
5
- def ask_adam_ai(question):
6
- url = "https://together.xyz"
7
-
8
- headers ={
9
- "Authorization": "Bearer 815c3ec04bb4db4d3fa7ffc64966d58d9ad7662c59efd5dfdf935ec213c9e97c"
10
- "Content-Type": "application/json"
11
- }
12
-
13
- data = {
14
- "model": "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
15
- "messages": [{"role":"user", "content": question}],
16
- "temperature":0.6
17
- }
18
-
19
- req = urllib.request.Resquest(url, data=json.dumps(data).encode('utf-8'),headers=headers)
20
-
21
- try:
22
- with urllib.request.urlopen(req) as response:
23
- res = json.loads(response.read().decode('utf-8'))
24
- return res['choices'][0]['message']['content']
25
- except Exception as e:
26
- return f"Error connecting to AdamAI engine: {str{e}}"
27
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
28
- gr.Markdown("# AdamAi")
29
- gr.Markdown("Running on browser:")
30
-
31
- user_input = gr.Textbox(label="Type here:", palceholder="Ask Adamai...")
32
- output_text = gr.Textbox(label="AdamAi Answer:")
33
-
34
- sumbit_btn = gr.Button("Ask AI")
35
- sumbit_btn.click(fn=ask_adam_ai, inputs=user_input, outputs=output_text)
36
-
37
- demo.launch()