Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import matplotlib.pyplot as plt | |
| from PIL import Image, ImageDraw | |
| import plotly.graph_objects as go | |
| import numpy as np | |
| import gradio as gr | |
| # --- Wireframe Design --- | |
| st.title("My Design Prototype") | |
| # Create a simple wireframe design for a UI mockup | |
| fig, ax = plt.subplots() | |
| # Drawing a simple mockup of a webpage (a box representing a webpage layout) | |
| rect = plt.Rectangle((0.1, 0.1), 0.8, 0.8, linewidth=2, edgecolor='blue', facecolor='lightblue') | |
| ax.add_patch(rect) | |
| # Add title and buttons as placeholders | |
| plt.text(0.5, 0.9, "My Webpage", horizontalalignment='center', fontsize=12, weight='bold') | |
| # Adding a button | |
| plt.text(0.5, 0.5, "Submit", horizontalalignment='center', fontsize=10, weight='bold', color='white', bbox=dict(facecolor='blue', alpha=0.5)) | |
| # Adjust axis and show the design | |
| plt.xlim(0, 1) | |
| plt.ylim(0, 1) | |
| plt.axis('off') # Hide axes | |
| st.pyplot(fig) | |
| # --- Image Generation --- | |
| img = Image.new('RGB', (300, 150), color = (255, 255, 255)) | |
| d = ImageDraw.Draw(img) | |
| # Add text or simple design elements | |
| d.text((10,10), "Design Prototype", fill=(0, 0, 0)) | |
| # Show image | |
| st.image(img, caption="Prototype Image") | |
| # --- Plotly Chart --- | |
| fig_plotly = go.Figure(data=go.Scatter(x=[1, 2, 3], y=[4, 5, 6], mode='lines')) | |
| fig_plotly.update_layout(title='Data Prototype', | |
| xaxis_title='X Axis', | |
| yaxis_title='Y Axis') | |
| # Display Plotly chart | |
| st.plotly_chart(fig_plotly) | |
| # --- Gradio Interface --- | |
| def greet(name): | |
| return f"Hello {name}!" | |
| iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| iface.launch(inline=True) | |