File size: 829 Bytes
8f26786
697670a
8f26786
697670a
8f26786
697670a
8f26786
 
697670a
8f26786
 
 
 
 
 
2ab9e4f
ac8fce8
8f26786
 
 
 
 
 
 
5b8affe
8f26786
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from fastapi import FastAPI
import gradio as gr
from core.agent import generate_response

app = FastAPI(title="Eroha AgentAPI v3.1 (Guru Edition)")

def chat_interface(user_input):
    return generate_response(user_input)

iface = gr.Interface(
    fn=chat_interface,
    inputs=gr.Textbox(lines=3, placeholder="Введите запрос..."),
    outputs="text",
    title="🤖 Eroha AgentAPI v3.1 — Guru Edition",
    description="Умный агент на базе Hugging Face Inference API"
)

@app.get("/health")
def health():
    return {"status": "ok"}

@app.get("/")
def index():
    return {"message": "Eroha AgentAPI v3.1 — running!"}

@app.get("/generate")
def generate(q: str):
    return {"result": generate_response(q)}

if __name__ == "__main__":
    iface.launch(server_name="0.0.0.0", server_port=7860)