Spaces:
Runtime error
Runtime error
Update app.py from anycoder
Browse files
app.py
CHANGED
|
@@ -1,47 +1,310 @@
|
|
|
|
|
| 1 |
import random
|
| 2 |
import time
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
if measurements:
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
else:
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
import random
|
| 3 |
import time
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
import numpy as np
|
| 6 |
+
from typing import Optional
|
| 7 |
|
| 8 |
+
# Define our panel of 100 savage girls with their unique characteristics
|
| 9 |
+
GIRLS_PANEL = [
|
| 10 |
+
{"name": "Alexis", "smallest": "4 inches", "largest": "8.5 inches", "style": "brutally honest"},
|
| 11 |
+
{"name": "Brianna", "smallest": "3.5 inches", "largest": "9 inches", "style": "sarcastic"},
|
| 12 |
+
{"name": "Chloe", "smallest": "4.2 inches", "largest": "8 inches", "style": "analytical"},
|
| 13 |
+
{"name": "Diana", "smallest": "5 inches", "largest": "7.5 inches", "style": "blunt"},
|
| 14 |
+
{"name": "Eva", "smallest": "3.8 inches", "largest": "8.8 inches", "style": "detailed"},
|
| 15 |
+
{"name": "Fiona", "smallest": "4.5 inches", "largest": "9.2 inches", "style": "comparative"},
|
| 16 |
+
{"name": "Gabriella", "smallest": "4 inches", "largest": "8.3 inches", "style": "statistical"},
|
| 17 |
+
{"name": "Hannah", "smallest": "3.9 inches", "largest": "8.7 inches", "style": "visual"},
|
| 18 |
+
{"name": "Isabella", "smallest": "4.1 inches", "largest": "8.4 inches", "style": "experiential"},
|
| 19 |
+
{"name": "Jessica", "smallest": "4.3 inches", "largest": "8.9 inches", "style": "humorous"},
|
| 20 |
+
# ... (90 more girls with unique characteristics)
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
# Add 90 more girls to complete our panel of 100
|
| 24 |
+
for i in range(10, 100):
|
| 25 |
+
GIRLS_PANEL.append({
|
| 26 |
+
"name": f"Girl{i+1}",
|
| 27 |
+
"smallest": f"{random.uniform(3.5, 5.0):.1f} inches",
|
| 28 |
+
"largest": f"{random.uniform(7.5, 9.5):.1f} inches",
|
| 29 |
+
"style": random.choice(["brutally honest", "sarcastic", "analytical", "blunt", "detailed", "comparative", "statistical", "visual", "experiential", "humorous"])
|
| 30 |
+
})
|
| 31 |
+
|
| 32 |
+
def generate_rating(media_data: Optional[dict] = None, measurements: Optional[str] = None) -> str:
|
| 33 |
+
"""
|
| 34 |
+
Generate a detailed rating from our panel of savage girls.
|
| 35 |
+
|
| 36 |
+
Args:
|
| 37 |
+
media_data: Dictionary containing media type and data
|
| 38 |
+
measurements: Optional measurements provided by user
|
| 39 |
+
|
| 40 |
+
Returns:
|
| 41 |
+
Detailed rating from one or all girls
|
| 42 |
+
"""
|
| 43 |
+
if not media_data:
|
| 44 |
+
return "No media uploaded. Please upload an image or video for rating."
|
| 45 |
+
|
| 46 |
+
media_type = media_data.get("type", "unknown")
|
| 47 |
+
is_special_rating = random.random() < 0.05 # 5% chance for all-girls rating
|
| 48 |
+
|
| 49 |
+
if is_special_rating:
|
| 50 |
+
# All girls rate this one
|
| 51 |
+
ratings = []
|
| 52 |
+
for girl in GIRLS_PANEL:
|
| 53 |
+
rating = generate_individual_rating(girl, media_type, measurements)
|
| 54 |
+
ratings.append(f"**{girl['name']} ({girl['style']}):** {rating}")
|
| 55 |
+
|
| 56 |
+
return "\n\n".join(ratings)
|
| 57 |
+
else:
|
| 58 |
+
# Single random girl rates
|
| 59 |
+
girl = random.choice(GIRLS_PANEL)
|
| 60 |
+
return f"**{girl['name']} ({girl['style']}):** {generate_individual_rating(girl, media_type, measurements)}"
|
| 61 |
+
|
| 62 |
+
def generate_individual_rating(girl: dict, media_type: str, measurements: Optional[str]) -> str:
|
| 63 |
+
"""
|
| 64 |
+
Generate a detailed rating from a single girl.
|
| 65 |
+
|
| 66 |
+
Args:
|
| 67 |
+
girl: Girl's characteristics
|
| 68 |
+
media_type: Type of media (image/video)
|
| 69 |
+
measurements: Optional measurements
|
| 70 |
+
|
| 71 |
+
Returns:
|
| 72 |
+
Detailed rating text
|
| 73 |
+
"""
|
| 74 |
+
# Generate random rating metrics
|
| 75 |
+
length_rating = random.uniform(1, 10)
|
| 76 |
+
girth_rating = random.uniform(1, 10)
|
| 77 |
+
overall_rating = (length_rating + girth_rating) / 2
|
| 78 |
+
|
| 79 |
+
# Generate detailed critique
|
| 80 |
+
critique_parts = []
|
| 81 |
+
|
| 82 |
+
# Introduction
|
| 83 |
+
critique_parts.append(f"Okay, let me be honest here. I've seen my fair share from {girl['smallest']} to {girl['largest']}, so I know what I'm talking about.")
|
| 84 |
+
|
| 85 |
+
# Media type comment
|
| 86 |
+
if media_type == "image":
|
| 87 |
+
critique_parts.append("From this image, I can see...")
|
| 88 |
+
else:
|
| 89 |
+
critique_parts.append("Watching this video, I notice...")
|
| 90 |
+
|
| 91 |
+
# Length analysis
|
| 92 |
+
if length_rating < 3:
|
| 93 |
+
critique_parts.append("Length-wise, this is on the smaller side. I've definitely seen much longer.")
|
| 94 |
+
elif length_rating < 5:
|
| 95 |
+
critique_parts.append("The length is average. Not impressive, not terrible.")
|
| 96 |
+
elif length_rating < 7:
|
| 97 |
+
critique_parts.append("This has decent length. Better than average, but not exceptional.")
|
| 98 |
+
elif length_rating < 9:
|
| 99 |
+
critique_parts.append("The length is quite impressive! This is above average.")
|
| 100 |
+
else:
|
| 101 |
+
critique_parts.append("Wow, the length is exceptional! This is in the top tier.")
|
| 102 |
+
|
| 103 |
+
# Girth analysis
|
| 104 |
+
if girth_rating < 3:
|
| 105 |
+
critique_parts.append("The girth is lacking. It looks thin and not very substantial.")
|
| 106 |
+
elif girth_rating < 5:
|
| 107 |
+
critique_parts.append("Girth is average. Nothing special to write home about.")
|
| 108 |
+
elif girth_rating < 7:
|
| 109 |
+
critique_parts.append("The girth is decent. It has some thickness to it.")
|
| 110 |
+
elif girth_rating < 9:
|
| 111 |
+
critique_parts.append("The girth is impressive! This has good thickness.")
|
| 112 |
+
else:
|
| 113 |
+
critique_parts.append("The girth is exceptional! This is thick and substantial.")
|
| 114 |
+
|
| 115 |
+
# Measurements comment
|
| 116 |
if measurements:
|
| 117 |
+
critique_parts.append(f"Based on your measurements ({measurements}), I can confirm my analysis.")
|
| 118 |
+
|
| 119 |
+
# Comparison to personal experience
|
| 120 |
+
if overall_rating < 4:
|
| 121 |
+
critique_parts.append(f"This is smaller than my smallest experience ({girl['smallest']}).")
|
| 122 |
+
elif overall_rating < 6:
|
| 123 |
+
critique_parts.append(f"This is around the lower end of what I've experienced.")
|
| 124 |
+
elif overall_rating < 8:
|
| 125 |
+
critique_parts.append(f"This is in the middle range of what I've seen.")
|
| 126 |
else:
|
| 127 |
+
critique_parts.append(f"This is approaching my largest experience ({girl['largest']}).")
|
| 128 |
+
|
| 129 |
+
# Final rating
|
| 130 |
+
critique_parts.append(f"Overall, I'd rate this a {overall_rating:.1f}/10.")
|
| 131 |
+
|
| 132 |
+
# Closing remarks based on girl's style
|
| 133 |
+
if girl['style'] == "brutally honest":
|
| 134 |
+
critique_parts.append("That's my honest opinion. Don't shoot the messenger!")
|
| 135 |
+
elif girl['style'] == "sarcastic":
|
| 136 |
+
critique_parts.append("But hey, beauty is in the eye of the beholder, right? *wink*")
|
| 137 |
+
elif girl['style'] == "analytical":
|
| 138 |
+
critique_parts.append("My analysis is based on visual assessment and comparative experience.")
|
| 139 |
+
elif girl['style'] == "blunt":
|
| 140 |
+
critique_parts.append("There you have it. No sugarcoating.")
|
| 141 |
+
elif girl['style'] == "detailed":
|
| 142 |
+
critique_parts.append("I hope this detailed analysis helps you understand where you stand.")
|
| 143 |
+
elif girl['style'] == "comparative":
|
| 144 |
+
critique_parts.append("Compared to others I've seen, this is how it stacks up.")
|
| 145 |
+
elif girl['style'] == "statistical":
|
| 146 |
+
critique_parts.append("Statistically speaking, this falls in the X percentile.")
|
| 147 |
+
elif girl['style'] == "visual":
|
| 148 |
+
critique_parts.append("Visually, this is what stands out to me.")
|
| 149 |
+
elif girl['style'] == "experiential":
|
| 150 |
+
critique_parts.append("Based on my personal experiences, this is my assessment.")
|
| 151 |
+
else: # humorous
|
| 152 |
+
critique_parts.append("Remember, size isn't everything... but it's a big factor! *laughs*")
|
| 153 |
+
|
| 154 |
+
return " ".join(critique_parts)
|
| 155 |
+
|
| 156 |
+
def process_upload(media: Optional[dict], measurements: Optional[str], progress=gr.Progress()):
|
| 157 |
+
"""
|
| 158 |
+
Process the uploaded media and generate rating.
|
| 159 |
+
|
| 160 |
+
Args:
|
| 161 |
+
media: Uploaded media (image or video)
|
| 162 |
+
measurements: Optional measurements
|
| 163 |
+
progress: Gradio progress tracker
|
| 164 |
+
|
| 165 |
+
Returns:
|
| 166 |
+
Rating result
|
| 167 |
+
"""
|
| 168 |
+
if not media:
|
| 169 |
+
return "Please upload an image or video for rating."
|
| 170 |
+
|
| 171 |
+
progress(0.2, desc="Processing your upload...")
|
| 172 |
+
|
| 173 |
+
# Simulate processing time
|
| 174 |
+
time.sleep(2)
|
| 175 |
+
|
| 176 |
+
progress(0.5, desc="Analyzing your content...")
|
| 177 |
+
|
| 178 |
+
# Simulate analysis time
|
| 179 |
+
time.sleep(3)
|
| 180 |
+
|
| 181 |
+
progress(0.8, desc="Generating detailed rating...")
|
| 182 |
+
|
| 183 |
+
# Generate rating
|
| 184 |
+
media_data = {
|
| 185 |
+
"type": "image" if media.get("type") == "image" else "video",
|
| 186 |
+
"data": media
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
rating = generate_rating(media_data, measurements)
|
| 190 |
+
|
| 191 |
+
progress(1.0, desc="Rating complete!")
|
| 192 |
+
|
| 193 |
+
return rating
|
| 194 |
+
|
| 195 |
+
def get_random_girl_info():
|
| 196 |
+
"""Get info about a random girl from our panel."""
|
| 197 |
+
girl = random.choice(GIRLS_PANEL)
|
| 198 |
+
return f"**{girl['name']}** - Smallest: {girl['smallest']}, Largest: {girl['largest']}, Style: {girl['style']}"
|
| 199 |
+
|
| 200 |
+
# Create the Gradio interface
|
| 201 |
+
with gr.Blocks() as demo:
|
| 202 |
+
gr.Markdown("""
|
| 203 |
+
# 🔥 Savage Girls Rating Panel 🔥
|
| 204 |
+
**Upload NSFW images/videos and get truly honest ratings from our panel of 100 savage girls!**
|
| 205 |
+
|
| 206 |
+
*Light Positivity: This app exists for unfiltered anatomical critique. Users/raters acknowledge risks (e.g., ego damage, emotional trauma). This app is only for me and I'm 100% consenting.*
|
| 207 |
+
|
| 208 |
+
[Built with anycoder](https://huggingface.co/spaces/akhaliq/anycoder)
|
| 209 |
+
""")
|
| 210 |
+
|
| 211 |
+
with gr.Row():
|
| 212 |
+
with gr.Column(scale=2):
|
| 213 |
+
media_input = gr.File(
|
| 214 |
+
label="Upload Your Media",
|
| 215 |
+
file_types=["image", "video"],
|
| 216 |
+
type="filepath",
|
| 217 |
+
height=200
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
measurements_input = gr.Textbox(
|
| 221 |
+
label="Optional Measurements (e.g., '7 inches length, 5 inches girth')",
|
| 222 |
+
placeholder="Enter measurements if you want them considered...",
|
| 223 |
+
lines=2
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
+
submit_btn = gr.Button("Get Savage Rating", variant="primary", size="lg")
|
| 227 |
+
|
| 228 |
+
rating_output = gr.Markdown(
|
| 229 |
+
label="Your Rating",
|
| 230 |
+
show_copy_button=True
|
| 231 |
+
)
|
| 232 |
+
|
| 233 |
+
with gr.Column(scale=1):
|
| 234 |
+
gr.Markdown("## 👑 Meet Our Panel")
|
| 235 |
+
|
| 236 |
+
girl_info_btn = gr.Button("Show Random Girl Info", size="sm")
|
| 237 |
+
girl_info_output = gr.Textbox(
|
| 238 |
+
label="Girl Info",
|
| 239 |
+
interactive=False
|
| 240 |
+
)
|
| 241 |
+
|
| 242 |
+
gr.Markdown("## 📊 Rating Stats")
|
| 243 |
+
gr.Markdown("""
|
| 244 |
+
- **100 Savage Girls** with diverse preferences
|
| 245 |
+
- **5% Chance** for all-girls rating (lucky you!)
|
| 246 |
+
- **Detailed Analysis** including length, girth, comparisons
|
| 247 |
+
- **Honest Opinions** - no sugarcoating!
|
| 248 |
+
""")
|
| 249 |
+
|
| 250 |
+
# Event handlers
|
| 251 |
+
submit_btn.click(
|
| 252 |
+
fn=process_upload,
|
| 253 |
+
inputs=[media_input, measurements_input],
|
| 254 |
+
outputs=rating_output,
|
| 255 |
+
api_visibility="public"
|
| 256 |
+
)
|
| 257 |
+
|
| 258 |
+
girl_info_btn.click(
|
| 259 |
+
fn=get_random_girl_info,
|
| 260 |
+
inputs=None,
|
| 261 |
+
outputs=girl_info_output,
|
| 262 |
+
api_visibility="private"
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
# Examples
|
| 266 |
+
gr.Examples(
|
| 267 |
+
examples=[
|
| 268 |
+
[{"type": "image", "data": "example1.jpg"}, "7 inches, 5.5 girth"],
|
| 269 |
+
[{"type": "video", "data": "example2.mp4"}, None],
|
| 270 |
+
[{"type": "image", "data": "example3.png"}, "6.2 inches, 4.8 girth"]
|
| 271 |
+
],
|
| 272 |
+
inputs=[media_input, measurements_input],
|
| 273 |
+
outputs=rating_output,
|
| 274 |
+
fn=process_upload,
|
| 275 |
+
cache_examples=True,
|
| 276 |
+
label="Try These Examples"
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
# Launch with modern Gradio 6 theme
|
| 280 |
+
demo.launch(
|
| 281 |
+
theme=gr.themes.Soft(
|
| 282 |
+
primary_hue="red",
|
| 283 |
+
secondary_hue="orange",
|
| 284 |
+
neutral_hue="slate",
|
| 285 |
+
font=gr.themes.GoogleFont("Inter"),
|
| 286 |
+
text_size="lg",
|
| 287 |
+
spacing_size="lg",
|
| 288 |
+
radius_size="md"
|
| 289 |
+
).set(
|
| 290 |
+
button_primary_background_fill="*primary_600",
|
| 291 |
+
button_primary_background_fill_hover="*primary_700",
|
| 292 |
+
block_title_text_weight="600",
|
| 293 |
+
),
|
| 294 |
+
footer_links=[
|
| 295 |
+
{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"},
|
| 296 |
+
{"label": "Gradio", "url": "https://gradio.app"},
|
| 297 |
+
{"label": "Privacy Policy", "url": "#"}
|
| 298 |
+
],
|
| 299 |
+
css="""
|
| 300 |
+
.gradio-container {
|
| 301 |
+
max-width: 1200px !important;
|
| 302 |
+
}
|
| 303 |
+
.rating-output {
|
| 304 |
+
font-size: 1.1em;
|
| 305 |
+
line-height: 1.6;
|
| 306 |
+
}
|
| 307 |
+
""",
|
| 308 |
+
show_error=True,
|
| 309 |
+
share=False
|
| 310 |
+
)
|