Spaces:
Runtime error
Runtime error
File size: 1,130 Bytes
1e7d879 |
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 |
import gradio as gr
from transformers import pipeline
# Load the text generation model
pipe = pipeline("text-generation", model="microsoft/Phi-3.5-mini-instruct", trust_remote_code=True)
# Define a function for emoji guessing game
def emoji_game(user_guess):
# Messages to send to the model
messages = [
{"role": "user", "content": f"Guess the word or phrase represented by these emojis: ππ©βπΎπͺπͺ."},
{"role": "user", "content": user_guess},
]
# Generate response from the model
response = pipe(messages)
# Process the response (for simplicity, let's just return the generated text)
return response[0]['generated_text']
# Create a Gradio interface
interface = gr.Interface(
fn=emoji_game, # Function to call when user submits input
inputs="text", # Input widget (user types their guess)
outputs="text", # Output widget (display model response)
title="Guess the Word from Emojis",
description="Try to guess the word or phrase represented by the emojis. Example: ππ§β‘ = Harry Potter."
)
# Launch the interface
interface.launch()
|