Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -157,11 +157,11 @@ def process_image(image):
|
|
157 |
|
158 |
# Format the result message
|
159 |
is_ai_generated = "Yes" if confidence >= 0.5 else "No"
|
160 |
-
result_message = f"Is this image AI-generated? {is_ai_generated}\n"
|
161 |
-
result_message += f"Confidence score: {confidence:.2%}\n\n"
|
162 |
|
163 |
if is_ai_generated == "Yes" and sources:
|
164 |
-
result_message += "Top possible AI models used:\n"
|
165 |
sorted_sources = sorted(sources.items(), key=lambda x: x[1], reverse=True)[:3]
|
166 |
for source, prob in sorted_sources:
|
167 |
if prob > 0.01:
|
@@ -189,9 +189,7 @@ def create_demo():
|
|
189 |
### How to use:
|
190 |
1. Upload an image (PNG, JPG, or JPEG)
|
191 |
2. Click the 'Submit' button
|
192 |
-
3. Get a detailed analysis of whether the image is AI-generated
|
193 |
-
|
194 |
-
Note: This application requires a valid NVIDIA API key set in environment variables.
|
195 |
"""
|
196 |
)
|
197 |
return demo
|
@@ -201,9 +199,9 @@ if __name__ == "__main__":
|
|
201 |
demo = create_demo()
|
202 |
demo.launch(
|
203 |
show_api=False,
|
204 |
-
show_error=
|
205 |
share=False,
|
206 |
-
quiet=
|
207 |
|
208 |
|
209 |
)
|
|
|
157 |
|
158 |
# Format the result message
|
159 |
is_ai_generated = "Yes" if confidence >= 0.5 else "No"
|
160 |
+
result_message = f"\n Is this image AI-generated? {is_ai_generated}\n"
|
161 |
+
result_message += f"\n Confidence score: {confidence:.2%}\n\n"
|
162 |
|
163 |
if is_ai_generated == "Yes" and sources:
|
164 |
+
result_message += "\n Top possible AI models used:\n"
|
165 |
sorted_sources = sorted(sources.items(), key=lambda x: x[1], reverse=True)[:3]
|
166 |
for source, prob in sorted_sources:
|
167 |
if prob > 0.01:
|
|
|
189 |
### How to use:
|
190 |
1. Upload an image (PNG, JPG, or JPEG)
|
191 |
2. Click the 'Submit' button
|
192 |
+
3. Get a detailed analysis of whether the image is AI-generated alongside the Model that might be used in generation.
|
|
|
|
|
193 |
"""
|
194 |
)
|
195 |
return demo
|
|
|
199 |
demo = create_demo()
|
200 |
demo.launch(
|
201 |
show_api=False,
|
202 |
+
show_error=False,
|
203 |
share=False,
|
204 |
+
quiet=False
|
205 |
|
206 |
|
207 |
)
|