Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,7 @@ don't include '.com' in outputs and give different names.
|
|
| 34 |
{}"""
|
| 35 |
|
| 36 |
|
|
|
|
| 37 |
def print_output(input):
|
| 38 |
inputs = tokenizer(
|
| 39 |
[
|
|
@@ -46,102 +47,130 @@ def print_output(input):
|
|
| 46 |
# outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
| 47 |
# tokenizer.batch_decode(outputs)
|
| 48 |
|
| 49 |
-
outputs = model.generate(**inputs, max_new_tokens =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
# # Streamlit app UI
|
| 67 |
-
# st.title("Echo Input Example")
|
| 68 |
-
|
| 69 |
-
# # Text box for user input
|
| 70 |
-
# user_input = st.text_input("Type something here:")
|
| 71 |
-
|
| 72 |
-
# # Button to submit input
|
| 73 |
-
# if st.button("Submit"):
|
| 74 |
-
# # Reprint the user input
|
| 75 |
-
# st.write(f"You typed: {print_output(user_input)}")
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
def main():
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
if __name__ == "__main__":
|
| 147 |
-
|
|
|
|
| 34 |
{}"""
|
| 35 |
|
| 36 |
|
| 37 |
+
|
| 38 |
def print_output(input):
|
| 39 |
inputs = tokenizer(
|
| 40 |
[
|
|
|
|
| 47 |
# outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
| 48 |
# tokenizer.batch_decode(outputs)
|
| 49 |
|
| 50 |
+
outputs = model.generate(**inputs, max_new_tokens = 100, use_cache = True)
|
| 51 |
+
return tokenizer.batch_decode(outputs)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# Streamlit app UI
|
| 55 |
+
st.title("Echo Input Example")
|
| 56 |
+
|
| 57 |
+
# Text box for user input
|
| 58 |
+
user_input = st.text_input("Type something here:")
|
| 59 |
+
|
| 60 |
+
# Button to submit input
|
| 61 |
+
if st.button("Submit"):
|
| 62 |
+
# Reprint the user input
|
| 63 |
+
st.write(f"You typed: {print_output(user_input)}")
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
# def print_output(input):
|
| 67 |
+
# inputs = tokenizer(
|
| 68 |
+
# [
|
| 69 |
+
# inf_prompt_1.format(
|
| 70 |
+
# input, # instruction
|
| 71 |
+
# "", # output - leave this blank for generation!
|
| 72 |
+
# ),
|
| 73 |
+
# ], return_tensors = "pt").to("cuda")
|
| 74 |
+
|
| 75 |
+
# # outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
| 76 |
+
# # tokenizer.batch_decode(outputs)
|
| 77 |
+
|
| 78 |
+
# outputs = model.generate(**inputs, max_new_tokens = 200, use_cache = True, temperature=0.5)
|
| 79 |
|
| 80 |
+
# n1 = tokenizer.batch_decode(outputs)[0].index('### Response:')
|
| 81 |
+
# output_ = tokenizer.batch_decode(outputs)[0][n1+13:].replace('.com','')
|
| 82 |
+
# n2 = output_.index('\n\n')
|
| 83 |
|
| 84 |
+
# dom_names = []
|
| 85 |
|
| 86 |
+
# for name in output_[:n2].split('\n'):
|
| 87 |
+
# if name != '':
|
| 88 |
+
# dom_names.append(name.split('.')[1])
|
| 89 |
|
| 90 |
+
# s = '\n'.join(dom_names)
|
| 91 |
+
|
| 92 |
+
# return tokenizer.batch_decode(s)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
# # # Streamlit app UI
|
| 96 |
+
# # st.title("Echo Input Example")
|
| 97 |
+
|
| 98 |
+
# # # Text box for user input
|
| 99 |
+
# # user_input = st.text_input("Type something here:")
|
| 100 |
+
|
| 101 |
+
# # # Button to submit input
|
| 102 |
+
# # if st.button("Submit"):
|
| 103 |
+
# # # Reprint the user input
|
| 104 |
+
# # st.write(f"You typed: {print_output(user_input)}")
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# def main():
|
| 108 |
+
|
| 109 |
+
# css_dark_mode = """
|
| 110 |
+
# <style>
|
| 111 |
+
# body {
|
| 112 |
+
# background-color: #121212;
|
| 113 |
+
# color: #f8f9fa;
|
| 114 |
+
# font-family: Arial, sans-serif;
|
| 115 |
+
# }
|
| 116 |
+
# .header {
|
| 117 |
+
# background: linear-gradient(90deg, #005c97, #363795);
|
| 118 |
+
# padding: 15px;
|
| 119 |
+
# margin-bottom: 15px;
|
| 120 |
+
# border-radius: 10px;
|
| 121 |
+
# box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
| 122 |
+
# text-align: center;
|
| 123 |
+
# }
|
| 124 |
+
# .header h1 {
|
| 125 |
+
# color: #ffffff;
|
| 126 |
+
# font-size: 36px;
|
| 127 |
+
# }
|
| 128 |
+
# .header h2 {
|
| 129 |
+
# color: #b0b0b0;
|
| 130 |
+
# font-size: 22px;
|
| 131 |
+
# font-family: Georgia, serif;
|
| 132 |
+
# }
|
| 133 |
+
# .stButton > button {
|
| 134 |
+
# background-color: #20c997;
|
| 135 |
+
# color: #ffffff;
|
| 136 |
+
# border: none;
|
| 137 |
+
# border-radius: 8px;
|
| 138 |
+
# padding: 10px 20px;
|
| 139 |
+
# font-size: 16px;
|
| 140 |
+
# cursor: pointer;
|
| 141 |
+
# transition: background-color 0.3s;
|
| 142 |
+
# }
|
| 143 |
+
# .stButton > button:hover {
|
| 144 |
+
# background-color: #17a589;
|
| 145 |
+
# }
|
| 146 |
+
# .success-box {
|
| 147 |
+
# background-color: #A1D6CB;
|
| 148 |
+
# padding: 10px;
|
| 149 |
+
# margin: 10px 0;
|
| 150 |
+
# border-radius: 8px;
|
| 151 |
+
# box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
| 152 |
+
# }
|
| 153 |
+
# </style>
|
| 154 |
+
# """
|
| 155 |
+
# # Inject the custom CSS
|
| 156 |
+
# st.markdown(css_dark_mode, unsafe_allow_html=True)
|
| 157 |
+
|
| 158 |
+
# # Header Section
|
| 159 |
+
# html_temp = """
|
| 160 |
+
# <div class="header">
|
| 161 |
+
# <h1>Dominious</h1>
|
| 162 |
+
# <h2>AI Based Domain Name Suggestion System</h2>
|
| 163 |
+
# </div>
|
| 164 |
+
# """
|
| 165 |
+
# st.markdown(html_temp, unsafe_allow_html=True)
|
| 166 |
+
# # st.title("Domain Name Suggestion System")
|
| 167 |
+
|
| 168 |
+
# # Get user input
|
| 169 |
+
# user_input = st.text_input("Describe your business here...")
|
| 170 |
+
|
| 171 |
+
# # Generate the response
|
| 172 |
+
# if st.button("Generate"):
|
| 173 |
+
# with st.spinner("Generating Domain Names..."):
|
| 174 |
+
# result = print_output(user_input)
|
| 175 |
+
# if __name__ == "__main__":
|
| 176 |
+
# main()
|