Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from google import genai
|
| 4 |
from google.genai import types
|
|
|
|
| 5 |
|
| 6 |
username = os.environ.get("APP_USERNAME")
|
| 7 |
password = os.environ.get("APP_PASSWORD")
|
|
@@ -32,6 +33,22 @@ def build_message(input_text, history):
|
|
| 32 |
)
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
def generate_with_history(input_text, history):
|
| 36 |
"""
|
| 37 |
- input_text: Die neue Nachricht
|
|
@@ -90,7 +107,7 @@ with gr.Blocks() as demo:
|
|
| 90 |
btn = gr.Button("Submit", visible=True)
|
| 91 |
|
| 92 |
btn.click(
|
| 93 |
-
fn=
|
| 94 |
inputs=[input_box, history_state],
|
| 95 |
outputs=[output_box, history_state],
|
| 96 |
api_name="generate",
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from google import genai
|
| 4 |
from google.genai import types
|
| 5 |
+
from gradio_client import Client
|
| 6 |
|
| 7 |
username = os.environ.get("APP_USERNAME")
|
| 8 |
password = os.environ.get("APP_PASSWORD")
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
|
| 36 |
+
def puter(input_text, history):
|
| 37 |
+
client = Client("mgokg/puter")
|
| 38 |
+
result = client.predict(
|
| 39 |
+
message=input_text,
|
| 40 |
+
model="gemini-2.5-flash-lite",
|
| 41 |
+
system_prompt="You are a helpful assistant.",
|
| 42 |
+
temperature=0.3,
|
| 43 |
+
max_tokens=8192,
|
| 44 |
+
web_search=True,
|
| 45 |
+
token_override="",
|
| 46 |
+
api_name="/chat",
|
| 47 |
+
)
|
| 48 |
+
return result
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
def generate_with_history(input_text, history):
|
| 53 |
"""
|
| 54 |
- input_text: Die neue Nachricht
|
|
|
|
| 107 |
btn = gr.Button("Submit", visible=True)
|
| 108 |
|
| 109 |
btn.click(
|
| 110 |
+
fn=puter,
|
| 111 |
inputs=[input_box, history_state],
|
| 112 |
outputs=[output_box, history_state],
|
| 113 |
api_name="generate",
|