app.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load a text generation pipeline with
|
| 5 |
-
llm_pipeline = pipeline(task="text-generation", model="
|
| 6 |
|
| 7 |
# Function to dynamically generate companion personality based on user request
|
| 8 |
def generate_companion_personality_request(input_text):
|
|
@@ -43,7 +43,7 @@ with gr.Blocks() as gradio_app:
|
|
| 43 |
# Chat interface for user input and response
|
| 44 |
gr.Markdown("### Companion Personality and Characteristics Generator")
|
| 45 |
chat_box = gr.Chatbot(label="Companion Assistant", placeholder="Ask for companion personality or characteristics...")
|
| 46 |
-
|
| 47 |
with gr.Row():
|
| 48 |
with gr.Column(scale=4):
|
| 49 |
input_box = gr.Textbox(label="Enter your request", placeholder="e.g., Generate personality for a kind companion...")
|
|
@@ -55,5 +55,5 @@ with gr.Blocks() as gradio_app:
|
|
| 55 |
|
| 56 |
# Submit button to handle chat interactions
|
| 57 |
submit_button.click(chat_with_companion, inputs=[input_box, chat_history], outputs=[chat_box, chat_history])
|
| 58 |
-
|
| 59 |
gradio_app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load a text generation pipeline with Flan-T5-small model
|
| 5 |
+
llm_pipeline = pipeline(task="text-generation", model="google/flan-t5-small")
|
| 6 |
|
| 7 |
# Function to dynamically generate companion personality based on user request
|
| 8 |
def generate_companion_personality_request(input_text):
|
|
|
|
| 43 |
# Chat interface for user input and response
|
| 44 |
gr.Markdown("### Companion Personality and Characteristics Generator")
|
| 45 |
chat_box = gr.Chatbot(label="Companion Assistant", placeholder="Ask for companion personality or characteristics...")
|
| 46 |
+
|
| 47 |
with gr.Row():
|
| 48 |
with gr.Column(scale=4):
|
| 49 |
input_box = gr.Textbox(label="Enter your request", placeholder="e.g., Generate personality for a kind companion...")
|
|
|
|
| 55 |
|
| 56 |
# Submit button to handle chat interactions
|
| 57 |
submit_button.click(chat_with_companion, inputs=[input_box, chat_history], outputs=[chat_box, chat_history])
|
| 58 |
+
|
| 59 |
gradio_app.launch()
|