Spaces:
Sleeping
Sleeping
Ley_Fill7
commited on
Commit
·
59c83e1
1
Parent(s):
34a2aae
Adjust used input part
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import random
|
2 |
import os
|
3 |
import re
|
|
|
4 |
from langchain_nvidia_ai_endpoints import ChatNVIDIA
|
5 |
|
6 |
-
|
7 |
-
nvidia_api_key = os.
|
8 |
|
9 |
# Initialize ChatNVIDIA for text generation
|
10 |
client = ChatNVIDIA(
|
@@ -81,13 +82,14 @@ def generate(starting_text):
|
|
81 |
if response_end != "":
|
82 |
return response_end
|
83 |
|
84 |
-
#
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
1 |
import random
|
2 |
import os
|
3 |
import re
|
4 |
+
import streamlit as st
|
5 |
from langchain_nvidia_ai_endpoints import ChatNVIDIA
|
6 |
|
7 |
+
os.environ["NVIDIA_API_KEY"] = "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"
|
8 |
+
nvidia_api_key = os.environ["NVIDIA_API_KEY"]
|
9 |
|
10 |
# Initialize ChatNVIDIA for text generation
|
11 |
client = ChatNVIDIA(
|
|
|
82 |
if response_end != "":
|
83 |
return response_end
|
84 |
|
85 |
+
# Streamlit UI
|
86 |
+
st.title("Generate MidJourney Prompts")
|
87 |
+
user_input = st.text_input("Enter a starting text for the MidJourney prompt:")
|
88 |
+
|
89 |
+
if st.button("Generate"):
|
90 |
+
if user_input:
|
91 |
+
generated_prompt = generate(user_input)
|
92 |
+
st.write("**Generated Prompt:**")
|
93 |
+
st.write(generated_prompt)
|
94 |
+
else:
|
95 |
+
st.warning("Please enter a starting text.")
|