randeom commited on
Commit
19cef8f
1 Parent(s): 3266303

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
3
+
4
+ # Load the Mistral model and tokenizer
5
+ model_name = "mistralai/Mistral-7B-Instruct-v0.2"
6
+ model = AutoModelForCausalLM.from_pretrained(model_name)
7
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
8
+
9
+ # Initialize the text generation pipeline
10
+ generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
11
+
12
+ # Streamlit UI
13
+ st.title("Waifu Character Generator")
14
+
15
+ # User inputs
16
+ name = st.text_input("Name of the Waifu")
17
+ hair_color = st.selectbox("Hair Color", ["Blonde", "Brunette", "Red", "Black", "Blue", "Pink"])
18
+ personality = st.selectbox("Personality", ["Tsundere", "Yandere", "Kuudere", "Dandere", "Genki", "Normal"])
19
+ outfit_style = st.selectbox("Outfit Style", ["School Uniform", "Maid Outfit", "Casual", "Kimono", "Gothic Lolita"])
20
+
21
+ # Generate button
22
+ if st.button("Generate Waifu"):
23
+ # Generate character description
24
+ prompt = f"Create a waifu character named {name} with {hair_color} hair, a {personality} personality, and wearing a {outfit_style}."
25
+ result = generator(prompt, max_length=150, num_return_sequences=1)[0]['generated_text']
26
+
27
+ # Display the generated character
28
+ st.subheader("Generated Waifu Character")
29
+ st.write(result)