Giter Site home page Giter Site logo

demo_fastapi's Introduction

fuel-consumption-end-to-end-ml

End to End Machine Learning Project on Fuel Consumption Prediction of 70s and 80s vehicles.

demo_fastapi's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

demo_fastapi's Issues

This may be just me but I get an error downloading every file

#. Here is my code, my Colab repository is https://colab.research.google.com/drive/1jFis0PX3FJy3DmWpbpbhIdjKD-r4Hzlf#scrollTo=QLfFzeIrMXLY

every file has an error downloading

Code

import urllib3
from urllib.parse import urlparse
import pandas as pd
import itertools
import shutil

from urllib3.util import Retry

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

classes = ["cat", "fish"]
set_types = ["train", "test", "val"]

def download_image(url, klass, data_type):
basename = os.path.basename(urlparse(url).path)
filename = "{}/{}/{}".format(data_type, klass, basename)
if not os.path.exists(filename):
try:
http = urllib3.PoolManager(retries=Retry(connect=1, read=1, redirect=2))
with http.request("GET", url, preload_content=False) as resp, open(
filename, "wb"
) as out_file:
if resp.status == 200:
shutil.copyfileobj(resp, out_file)
else:
print("Error downloading {}".format(url))
resp.release_conn()
except:
print("Error downloading {}".format(url))

if name == "main":
if not os.path.exists("images.csv"):
print("Error: can't find images.csv!")
sys.exit(0)

# get args and create output directory
imagesDF = pd.read_csv("images.csv")

for set_type, klass in list(itertools.product(set_types, classes)):
    path = "./{}/{}".format(set_type, klass)
    if not os.path.exists(path):
        print("Creating directory {}".format(path))
        os.makedirs(path)

print("Downloading {} images".format(len(imagesDF)))

result = [
    download_image(url, klass, data_type)
    for url, klass, data_type in zip(
        imagesDF["url"], imagesDF["class"], imagesDF["type"]
    )
]
sys.exit(0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.