swyx commited on
Commit
893a228
1 Parent(s): 98c54ce
Files changed (3) hide show
  1. .cursorrules +18 -0
  2. README.md +18 -1
  3. requirements.txt +2 -1
.cursorrules ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You use Python 3.12 and Frameworks: gradio.
2
+ Here are some best practices and rules you must follow:
3
+
4
+
5
+ 1. **Use Meaningful Names**: Choose descriptive variable, function, and class names. For example, use `calculate_total_revenue` instead of `calc_rev`.
6
+ 2. **Follow PEP 8**: Adhere to the Python Enhancement Proposal 8 style guide for formatting. This includes using 4 spaces for indentation, limiting line length to 79 characters, and using snake_case for function names.
7
+ 3. **Use Docstrings**: Document functions and classes with docstrings to explain their purpose, parameters, return values, and any exceptions raised. Use triple quotes for multi-line docstrings.
8
+ 4. **Comment Code**: Add comments to explain the "why" of the code before writing complex logic or non-obvious implementations. Avoid redundant comments that merely restate the code.
9
+ 5. **Implement Logging**: Use the `logging` module to log the flow of the code. Log major events, function calls with parameters, return values, and timestamps. Set appropriate log levels (DEBUG, INFO, WARNING, ERROR, CRITICAL) for different types of messages.
10
+ 6. **Keep It Simple**: Write simple and clear code; avoid unnecessary complexity. Break down complex functions into smaller, more manageable pieces. Follow the Single Responsibility Principle.
11
+ 7. **Use List Comprehensions**: Prefer list comprehensions for creating lists over traditional loops when appropriate
12
+ 8. **Handle Failures and Exceptions**: Use try-except blocks to handle exceptions gracefully. For network requests, use the `tenacity` library to implement retry logic with exponential backoff.
13
+ 9. **Use Type Hints**: Utilize type hints for function parameters, return values, and variable annotations to improve code clarity and enable static type checking. For example: `def greet(name: str) -> str:`.
14
+ 10. **Implement All Functions Fully**: Ensure all functions are fully implemented with no placeholders or TODOs left in the code. Each function should be complete and functional.
15
+ 11. **Minimize Global Variables**: Limit the use of global variables to reduce side effects and improve code maintainability. Use function parameters and return values to pass data instead.
16
+ 12. **Use Context Managers**: Employ context managers (with statements) for resource management, such as file operations or database connections, to ensure proper cleanup.
17
+
18
+ These rules will help you write clean, efficient, and maintainable Python code.
README.md CHANGED
@@ -11,4 +11,21 @@ license: mit
11
  short_description: clientisde bee sdk
12
  ---
13
 
14
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  short_description: clientisde bee sdk
12
  ---
13
 
14
+ An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
15
+
16
+ ## hosted
17
+
18
+ https://huggingface.co/spaces/swyx/BeeWeb?logs=build
19
+
20
+ ## running
21
+
22
+ ```bash
23
+ gradio app.py
24
+ ```
25
+
26
+ This will start your Gradio app with hot-reloading enabled. Now, whenever you make changes to your app.py file and save it, the server will automatically restart, and your changes will be reflected immediately in the browser.
27
+
28
+ Some additional tips:
29
+ - Make sure you're running this command from the directory containing your app.py file.
30
+ - If you want to specify a port, you can use: gradio app.py --port 8080 (replace 8080 with your desired port number).
31
+ - If you're developing locally and want to make your app accessible over your local network, you can add the --share flag: gradio app.py --share
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  huggingface_hub==0.25.2
2
  beeai==1.0.1
3
- gradio==5.1.0
 
 
1
  huggingface_hub==0.25.2
2
  beeai==1.0.1
3
+ gradio==5.1.0
4
+ gradio-tools==0.0.9