Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Import the necessary libraries
|
| 2 |
import gradio as gr
|
| 3 |
+
from transformers import pipeline
|
| 4 |
|
| 5 |
+
# Load and launch the Gradio interface for the movie plot generator model
|
| 6 |
+
gr.load("models/SimonThormeyer/movie-plot-generator-longer-plots").launch()
|
| 7 |
+
|
| 8 |
+
# Define the pre-trained model for dialogue generation
|
| 9 |
+
pretrained_model_name = "microsoft/DialoGPT-small" # You can choose a different dialogue generation model if needed
|
| 10 |
+
custom_model_task = "text-generation" # Task remains text-generation for dialogue generation
|
| 11 |
+
|
| 12 |
+
# Create a pipeline for dialogue generation using the pre-trained model
|
| 13 |
+
pipe = pipeline(custom_model_task, model=pretrained_model_name)
|
| 14 |
+
|
| 15 |
+
# Define a specific input prompt for generating dialogue
|
| 16 |
+
input_prompt = "Character 1: Hey, how's it going?" # Example starting prompt for a dialogue
|
| 17 |
+
|
| 18 |
+
# Generate initial dialogue based on the input prompt
|
| 19 |
+
generated_dialogue = pipe(input_prompt)
|
| 20 |
+
|
| 21 |
+
# Print the generated dialogue
|
| 22 |
+
print(generated_dialogue)
|