Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,19 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
|
| 4 |
-
# Load the fine-tuned
|
| 5 |
-
generator = pipeline("text-generation", model="shibly100/gpt2_corporate_leadership")
|
| 6 |
-
|
| 7 |
-
#
|
| 8 |
-
def chat_with_ai(
|
| 9 |
-
|
| 10 |
-
response
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
chat_with_ai,
|
| 21 |
-
title="🗣️ SPARKY Corporate Leadership AI",
|
| 22 |
-
description="🤖 Ask anything about corporate leadership and get AI-powered responses! Your conversation history is remembered.",
|
| 23 |
-
theme="soft", # This gives it a sleek, modern look like ChatGPT
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
# Launch the chatbot
|
| 27 |
-
chatbot.launch()
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load the fine-tuned model
|
| 5 |
+
generator = pipeline("text-generation", model="shibly100/gpt2_corporate_leadership")
|
| 6 |
+
|
| 7 |
+
# Function to generate responses
|
| 8 |
+
def chat_with_ai(prompt, history=[]):
|
| 9 |
+
response = generator(prompt, max_length=200, do_sample=True, top_p=0.95, top_k=50, temperature=0.7)
|
| 10 |
+
return response[0]["generated_text"]
|
| 11 |
+
|
| 12 |
+
# Fast and simple chat interface
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown("# SPARKY Corporate Leadership AI")
|
| 15 |
+
gr.Markdown("Ask anything about corporate leadership and get AI-powered responses!")
|
| 16 |
+
|
| 17 |
+
chatbot = gr.ChatInterface(chat_with_ai)
|
| 18 |
+
|
| 19 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|