Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from datasets import load_dataset
|
| 3 |
+
|
| 4 |
+
# Load the WikiArt dataset
|
| 5 |
+
dataset = load_dataset("huggan/wikiart")
|
| 6 |
+
|
| 7 |
+
# Function to display artwork details
|
| 8 |
+
def display_artwork(index):
|
| 9 |
+
record = dataset["train"][index]
|
| 10 |
+
return record["image"], f"Welcome to the Gallery\n\nTitle: {record['title']}\nArtist: {record['artist']}\nStyle: {record['style']}\nGenre: {record['genre']}\n\nStep into the world of art and explore its details."
|
| 11 |
+
|
| 12 |
+
# Gradio Interface
|
| 13 |
+
gr.Interface(
|
| 14 |
+
fn=display_artwork,
|
| 15 |
+
inputs=gr.Number(label="Artwork Index"),
|
| 16 |
+
outputs=[gr.Image(label="Artwork"), gr.Text(label="Details")],
|
| 17 |
+
title="Virtual AI Art Gallery"
|
| 18 |
+
).launch()
|