Spaces:
Sleeping
Sleeping
File size: 1,868 Bytes
e9f8029 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
import gradio as gr
# Function to generate description from link (dummy implementation)
def generate_description(link):
# In a real-world scenario, you would use this function to process the link
# and generate a description. For this example, we'll just return a dummy description.
if "example.com" in link:
return "This is a description for example.com"
elif "google.com" in link:
return "This is a description for google.com"
else:
return "Description not available for this link."
# Custom CSS for styling
custom_css = """
body {
background-color: #f0f8ff;
font-family: 'Arial', sans-serif;
}
.gradio-container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.gradio-input, .gradio-output {
margin-bottom: 20px;
}
.gradio-input input[type="text"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.gradio-output textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
resize: none;
}
.gradio-button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.gradio-button:hover {
background-color: #45a049;
}
"""
# Create the Gradio interface with custom CSS
iface = gr.Interface(
fn=generate_description, # Function to call
inputs="text", # Input type: text (for the link)
outputs="text", # Output type: text (for the description)
title="Link to Description",
description="Enter a link to get a description.",
examples=[
["https://www.example.com"],
["https://www.google.com"],
["https://www.github.com"]
],
css=custom_css
)
# Launch the interface
iface.launch() |