Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Setting up the Coretex brain
|
| 5 |
+
# Using Qwen 2.5 3B - very powerful and free to use immediately
|
| 6 |
+
model_id = "Qwen/Qwen2.5-3B-Instruct"
|
| 7 |
+
pipe = pipeline("text-generation", model=model_id, device_map="auto")
|
| 8 |
+
|
| 9 |
+
def coretex_chat(user_input):
|
| 10 |
+
messages = [{"role": "user", "content": user_input}]
|
| 11 |
+
# Coretex thinks here...
|
| 12 |
+
response = pipe(messages, max_new_tokens=256)
|
| 13 |
+
return response[0]['generated_text'][-1]['content']
|
| 14 |
+
|
| 15 |
+
# The interface humans see (we'll add the API for your bot later)
|
| 16 |
+
demo = gr.Interface(
|
| 17 |
+
fn=coretex_chat,
|
| 18 |
+
inputs=gr.Textbox(label="Message Coretex"),
|
| 19 |
+
outputs=gr.Textbox(label="Response"),
|
| 20 |
+
title="Coretex AI System"
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
demo.launch()
|