AdamAi / index.html
Ghanmidev2012's picture
Update index.html
0ca3532 verified
Raw History Blame Contribute Delete
1.91 kB
<!DOCTYPE html>
<html>
<head>
<title>AdamAi Beta 1</title>
<!-- Chargement de l'environnement Gradio-lite pour navigateur -->
<script type="module" src="https://jsdelivr.net"></script>
<link rel="stylesheet" href="https://jsdelivr.net" />
<style>
body { margin: 0; background-color: #f9fafb; font-family: sans-serif; }
</style>
</head>
<body>
<!-- Composant Gradio App -->
<gradio-app>
<main-python>
import gradio as gr
import urllib.request
import json
def ask_adam_ai(question):
# ADRESSE API CORRECTE ET FIXE :
url = "https://together.xyz"
headers = {
"Authorization": "Bearer 815c3ec04bb4db4d3fa7ffc64966d58d9ad7662c59efd5dfdf935ec213c9e97c",
"Content-Type": "application/json"
}
data = {
"model": "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
"messages": [{"role": "user", "content": question}],
"temperature": 0.6
}
req = urllib.request.Request(url, data=json.dumps(data).encode('utf-8'), headers=headers)
try:
with urllib.request.urlopen(req) as response:
res = json.loads(response.read().decode('utf-8'))
return res['choices']['message']['content']
except Exception as e:
return f"Error connecting to AdamAi engine: {str(e)}"
# Interface graphique générée par le navigateur
with gr.Blocks(theme=gr.themes.Soft()) as demo:
gr.Markdown("# 🤖 AdamAi Beta 1")
gr.Markdown("Running completely serverless in your browser via Gradio-lite!")
user_input = gr.Textbox(label="Write your question:", placeholder="Ask AdamAi anything...")
output_text = gr.Textbox(label="AdamAi Answer:", lines=6)
submit_btn = gr.Button("Ask AI", variant="primary")
submit_btn.click(fn=ask_adam_ai, inputs=user_input, outputs=output_text)
demo.launch()
</main-python>
</gradio-app>
</body>
</html>