Zenkad commited on
Commit
f9ec801
·
verified ·
1 Parent(s): 665a634

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -10
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import os, requests, gradio as gr
2
 
3
- # 🔗 Her zaman açık modeller
4
  PRIMARY_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
5
  FALLBACK_URL = "https://api-inference.huggingface.co/models/microsoft/Phi-3-mini-4k-instruct"
6
-
7
  HF_TOKEN = os.getenv("HF_TOKEN")
8
  HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"}
9
 
 
10
  def ask_model(url, message):
11
  payload = {
12
  "inputs": message,
@@ -24,6 +24,7 @@ def ask_model(url, message):
24
  except Exception:
25
  return None
26
 
 
27
  def chat(message, history):
28
  history = history or []
29
  reply = ask_model(PRIMARY_URL, message)
@@ -34,24 +35,54 @@ def chat(message, history):
34
  history.append((message, reply))
35
  return history, history
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  theme = gr.themes.Soft(primary_hue="blue", neutral_hue="slate").set(
38
  body_background_fill="#0f172a",
39
  block_background_fill="#1e293b",
40
  block_title_text_color="#38bdf8"
41
  )
42
 
43
- with gr.Blocks(theme=theme, title="ZenkaMind v13") as demo:
 
44
  gr.Markdown(
45
- "<h1 style='text-align:center;color:#38bdf8'>🧠 ZenkaMind v13</h1>"
46
- "<p style='text-align:center;color:#94a3b8'>Türkçe yapay zekâ sohbet asistanı Zephyr + Phi-3 Mini</p>"
47
  )
48
 
49
- chat_ui = gr.Chatbot(height=460, label="ZenkaMind")
50
- msg = gr.Textbox(placeholder="Mesajınızı yazın ve Enter’a basın…", show_label=False)
51
- clear = gr.Button("🧹 Temizle")
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- msg.submit(chat, [msg, chat_ui], [chat_ui, chat_ui])
54
- clear.click(lambda: None, None, chat_ui, queue=False)
55
 
56
  gr.Markdown("<p style='text-align:center;font-size:12px;color:#64748b'>© 2025 ZenkaMind Bilişim & Teknoloji</p>")
57
 
 
1
  import os, requests, gradio as gr
2
 
3
+ # 🔗 Modeller
4
  PRIMARY_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
5
  FALLBACK_URL = "https://api-inference.huggingface.co/models/microsoft/Phi-3-mini-4k-instruct"
 
6
  HF_TOKEN = os.getenv("HF_TOKEN")
7
  HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"}
8
 
9
+ # 🧠 Model bağlantısı
10
  def ask_model(url, message):
11
  payload = {
12
  "inputs": message,
 
24
  except Exception:
25
  return None
26
 
27
+ # 💬 Sohbet sistemi
28
  def chat(message, history):
29
  history = history or []
30
  reply = ask_model(PRIMARY_URL, message)
 
35
  history.append((message, reply))
36
  return history, history
37
 
38
+ # 💰 Görev paneli simülasyonu
39
+ def free_tasks():
40
+ return """🎯 **Free Görevler (14 Görev)**
41
+ - 4 Reklam İzle → 5₺
42
+ - Günlük Giriş → 2₺
43
+ - 1 Anket Doldur → 3₺
44
+ - 1 Arkadaş Davet Et → 10₺
45
+ - Görevleri tamamla, 500₺ olduğunda çekim yap!"""
46
+
47
+ def premium_tasks():
48
+ return """💎 **Premium Görevler (30 Görev)**
49
+ - 5 Reklam İzle → 10₺
50
+ - 2 Anket Doldur → 6₺
51
+ - Günlük Bonus Görevi → 15₺
52
+ - Görevleri tamamla, 500₺ olduğunda çekim yap!
53
+ - Premium kullanıcılar 2x kazanç alır!"""
54
+
55
+ # 🎨 Tema ayarları
56
  theme = gr.themes.Soft(primary_hue="blue", neutral_hue="slate").set(
57
  body_background_fill="#0f172a",
58
  block_background_fill="#1e293b",
59
  block_title_text_color="#38bdf8"
60
  )
61
 
62
+ # 🧱 Arayüz
63
+ with gr.Blocks(theme=theme, title="ZenkaMind Platform v1.0") as demo:
64
  gr.Markdown(
65
+ "<h1 style='text-align:center;color:#38bdf8'>🧠 ZenkaMind Platform</h1>"
66
+ "<p style='text-align:center;color:#94a3b8'>Free & Premium Görev + Yapay Zekâ Asistanı</p>"
67
  )
68
 
69
+ with gr.Row():
70
+ with gr.Column(scale=1):
71
+ gr.Markdown("### 💼 Görev Paneli")
72
+ tab = gr.TabbedInterface(
73
+ [gr.Markdown(free_tasks()), gr.Markdown(premium_tasks())],
74
+ ["Free Kullanıcılar", "Premium Kullanıcılar"]
75
+ )
76
+ gr.Markdown("<p style='font-size:14px;color:#94a3b8'>💰 Güncel Kazanç: <b>₺245.00</b></p>")
77
+
78
+ with gr.Column(scale=2):
79
+ gr.Markdown("### 🤖 ZenkaMind Sohbet Asistanı")
80
+ chat_ui = gr.Chatbot(height=460, label="ZenkaMind Chat")
81
+ msg = gr.Textbox(placeholder="Mesajınızı yazın ve Enter’a basın…", show_label=False)
82
+ clear = gr.Button("🧹 Temizle")
83
 
84
+ msg.submit(chat, [msg, chat_ui], [chat_ui, chat_ui])
85
+ clear.click(lambda: None, None, chat_ui, queue=False)
86
 
87
  gr.Markdown("<p style='text-align:center;font-size:12px;color:#64748b'>© 2025 ZenkaMind Bilişim & Teknoloji</p>")
88