Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import streamlit as st
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from gradio_client import Client
|
4 |
import re
|
5 |
-
from pycoingecko import CoinGeckoAPI
|
6 |
|
7 |
# Set the page config
|
8 |
st.set_page_config(layout="wide")
|
@@ -48,6 +47,7 @@ def generate_text(prompt, temperature=0.9, max_new_tokens=512, top_p=0.95, repet
|
|
48 |
st.error(f"Error generating text: {e}")
|
49 |
return ""
|
50 |
|
|
|
51 |
def generate_image(prompt):
|
52 |
try:
|
53 |
result = image_client.predict(
|
@@ -65,23 +65,9 @@ def generate_image(prompt):
|
|
65 |
st.write("Full error details:", e)
|
66 |
return None
|
67 |
|
68 |
-
def get_pepe_price():
|
69 |
-
cg = CoinGeckoAPI()
|
70 |
-
try:
|
71 |
-
price_data = cg.get_price(ids='pepe', vs_currencies='usd')
|
72 |
-
return price_data['pepe']['usd']
|
73 |
-
except Exception as e:
|
74 |
-
st.error(f"Error fetching PEPE price: {e}")
|
75 |
-
return None
|
76 |
-
|
77 |
def main():
|
78 |
st.title("Pepe Meme Generator")
|
79 |
|
80 |
-
# Fetch and display the live price of PEPE token
|
81 |
-
pepe_price = get_pepe_price()
|
82 |
-
if pepe_price:
|
83 |
-
st.markdown(f"### Current PEPE Price: ${pepe_price}")
|
84 |
-
|
85 |
# User inputs
|
86 |
col1, col2 = st.columns(2)
|
87 |
with col1:
|
@@ -133,4 +119,4 @@ def main():
|
|
133 |
st.image(image_path, caption="Generated Pepe Meme Image")
|
134 |
|
135 |
if __name__ == "__main__":
|
136 |
-
main()
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from gradio_client import Client
|
4 |
import re
|
|
|
5 |
|
6 |
# Set the page config
|
7 |
st.set_page_config(layout="wide")
|
|
|
47 |
st.error(f"Error generating text: {e}")
|
48 |
return ""
|
49 |
|
50 |
+
# Updated part for the new API
|
51 |
def generate_image(prompt):
|
52 |
try:
|
53 |
result = image_client.predict(
|
|
|
65 |
st.write("Full error details:", e)
|
66 |
return None
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
def main():
|
69 |
st.title("Pepe Meme Generator")
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
# User inputs
|
72 |
col1, col2 = st.columns(2)
|
73 |
with col1:
|
|
|
119 |
st.image(image_path, caption="Generated Pepe Meme Image")
|
120 |
|
121 |
if __name__ == "__main__":
|
122 |
+
main()
|