Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
gradio as gr
|
| 3 |
+
pip install -r requirements.txt
|
| 4 |
+
import streamlit as st
|
| 5 |
+
from gradio import Interface
|
| 6 |
+
|
| 7 |
+
# Define the addition function
|
| 8 |
+
def add(a, b):
|
| 9 |
+
return a + b
|
| 10 |
+
|
| 11 |
+
# Create the user interface using Gradio and Streamlit
|
| 12 |
+
add_ui = Interface(fn=add, inputs="number", outputs="text")
|
| 13 |
+
st.title("Streamlit & Gradio Addition Calculator")
|
| 14 |
+
add_block = add_ui.launch()
|
| 15 |
+
st.markdown(f'**Input:** {add_block.inputs}')
|
| 16 |
+
st.markdown(f'**Output:** {add_block.outputs[0]}')
|